Initializers are called to create a new instance of a particular type. In its simplest form, an initializer is like an instance method with no parameters
Questions tagged [initializer]
684 questions
0
votes
1 answer
C++ txt file passing thru command line ( std::ifstream inFile has initializer but incomplete type)
I am trying to read a list.txt file with multiple items (as below)
100/1
111/1
115/2
116/3
120/1
through command prompt say program.exe list.txt , so argv[1] will be the txt file list.txt (kept in cwd)
Then i need to separate 100/1 into…

vipin
- 43
- 1
- 9
0
votes
2 answers
E4 Preference Initializer won´t get called
I´m trying to migrate my e3-rcp-app to a e4-rcp-app.
Therefore I need to define my default Preferences. (Not the Pref.Pages)
And by doing and trying so, I just can´t get my Initializer called. Here Is my initializer-class:
public class…

Elias S
- 118
- 10
0
votes
1 answer
Using variables in a Ruby Gem
What is the correct way to use configurable variables in a Ruby gem to be used in a Rails app? We use timezone in this example which is likely a constant but would also be using installation-specific variables such as home_city, etc.
Constants
Can…

csi
- 9,018
- 8
- 61
- 81
0
votes
2 answers
Using 'DropCreateDatabaseWhenModelChanges' error
When I add this code Database.SetInitializer(new DropCreateDatabaseWhenModelChanges()); in DbContext file, I get the following error:
The type or namespace name 'DropCreateDatabaseWhenModelChanges' could not be found (are you missing a using…

refresh
- 1,319
- 2
- 20
- 71
0
votes
1 answer
C++ initializer list from other file
I have a question about the c++ initializer list.
I have a class with const structs that need to be initialized in the initializer list, because they're const. This works perfectly this way:
bglib::bglib()
: ble_class_evt_handlers( …

Jan Roorda
- 133
- 2
- 13
0
votes
0 answers
ViewController has no initializers, using core bluetooth
Please don't mark my question as duplicated even if it looks like answered many times.
I really have a problem with "ViewController has no initializers", using CoreBluetooth
I found many similar problems here on stackoverflow (like: Class…

Bart
- 21
- 5
0
votes
1 answer
Swift: Global Var Declaration Unwanted
import UIKit
var options = [String]()
var correctAns = Int()
var question : String
class quizController: UIViewController {
@IBOutlet weak var questionLabel: UILabel!
@IBOutlet weak var button1: UIButton!
@IBOutlet weak var…

Raghav V.
- 23
- 3
0
votes
1 answer
Cannot find an initializer for type
I'm getting an error saying
Cannot find an initializer for type 'SmileyScene' that accepts an
argument list of type '(fileNamed: String)'
I'm new to swift please help.
import UIKit
import SpriteKit
introLabel?.runAction(fadeOut, completion:…

Evan Peterson
- 3
- 1
0
votes
0 answers
Non-const lvalue reference initialized to prvalue
If A is a class-type, the expression A() is a prvalue, correct?
So why is it legal to do
A &ARef = A();
Also, I found this:
A reference to T can be initialized with an object of type T, a function of type T, or an object implicitly convertible to…

user42768
- 1,951
- 11
- 22
0
votes
1 answer
Initializer doesn't seem to be loading
I have an API wrapper with the following code:
module MyApi
mattr_accessor :app_id
end
I'm trying to set the value of app_id in an initializer like this:
# config/initializers/my_api.rb
MyApi.app_id =…

sixty4bit
- 7,422
- 7
- 33
- 57
0
votes
2 answers
Initialising string variable from a pointer array (in C)
I have something like:
static const char *array[] = {
"One String",
"Second String",
"Third",
"etc",
};
I want to define a new string variable new_var and initialize it with the first string in array. So array[0]. So something…
user3091673
0
votes
1 answer
Create objects in database as Rails server begins
I'm working with a Rails application that is currently creating classes before and after the User class has been created or saved. The problem I'm experiencing with this path is that one class is reading from a very large S3 AWS bucket, there are…

Christina Leuci
- 203
- 2
- 18
0
votes
2 answers
Having difficulty passing initialization list for constructor for parent and child objects
I have to make constructors with height+width or radius as well as three new optional parameters for x,y,z coordinates with default values of zero.
All four constructors (circle value and reference, rectangle value and reference) must have an…

Amy
- 3
- 1
0
votes
0 answers
C#- A field initializer cannot reference the non-static field, method, or property 'InetTimeManager.MainForm.IniPath'
I am fairly new to C# and I am currently writing a program and this program should be able to write to an Ini File, that is why I used this class
public class IniFile
{
public string path;
[DllImport("kernel32")]
private static extern…

Fliwatt
- 9
- 1
0
votes
1 answer
Initializer lists
point2d is a struct containing two double vars x and y.
Projectile::Projectile(Point2D p1, double x1, double y1){
: xVel(x1), yVel(x1), pos.x(p1.x), pos.y(p1.y) { }
}
Gives an error message saying expected expression at the :
Any ideas, not a…