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
3 answers
What has happened to less in Twitter Bootstrap on Initializr.com?
I just kickstarted a new project with Initializr. First I realized that the options for the stylesheet was removed and later I realized that Twitter Bootstrap doesn't come with LESS as default Stylesheet as well.
Did I miss something? I really liked…

Marvin Strenger
- 195
- 1
- 10
0
votes
2 answers
Does 'heroku restart' automatically calls the initializers in a rails app?
I've recently added some codes in the initialiser file of my rails application. Like any other rails app, I have to restart the app for it to call the initializers again. Does 'heroku restart' does the same thing (after committing the files etc.)?…

user192249
- 443
- 2
- 6
- 16
0
votes
2 answers
session_store initializer working in production, but not development
I have a site with multiple subdomains, and have added :domain => :all to my session store as follows, so that my logins persist across all subdomains.
`MyApp::Application.config.session_store :cookie_store, key: '_MyApp_session', :domain =>…

umezo
- 1,519
- 1
- 19
- 33
0
votes
3 answers
Ruby. Symbol '=' in to the setter name and initialization of an object
class Item
def name=(name_value)
@name = name_value
end
def name
@name
end
end
In the first case:
item = Item.new
item.name=("value")
puts item.class
I keep getting.
Item
In the second case:
item =…

user1512598
- 3
- 1
0
votes
1 answer
c++ compile error:expected initializer before ‘<’ token
I'm trying to compile a c++ program that i wrote myself. And I'm having trouble compiling it.
The quicksort.hpp file is:
#include
#include
#include
#include
#include "cv.h"
#include "cv.hpp"
#include…
user991511
0
votes
1 answer
How can a C++ array be value-initialized?
1) In C++, is providing the initializer list {} the same as {0}? Will the statements:
int x[10]={};
int x[10]={0};
both produce the same array with all elements initialized to 0?
2) On systems/compilers where NULL is not 0, do default-value…

user553702
- 2,819
- 5
- 23
- 27
0
votes
3 answers
Is a constructor exactly the same as an initializer?
In C++ or Objective-C, is the term "constructor" exactly the same as "initializer"?
The reason is that, whenever I see the term "constructor", it feels somewhat vague, because it also feels like the constructor is responsible for setting up the…

Jeremy L
- 3,770
- 6
- 41
- 62
0
votes
2 answers
general setup for searchify in rails, how to access variable from initializer file
how do i access a variable from an initializer file?
i have a file called search.rb in my initializer folder
api_client = IndexTank::Client.new 'http://:xxyyzz@xv9v.api.searchify.com'
index = api_client.indexes 'idx'
however, in my controller…

Sasha
- 3,281
- 7
- 34
- 52
0
votes
1 answer
local variable in object initializers
The question is: Is it possible to create a structure like the folowing using object initializers in JavaScript?
var human = new function (years) {
var age = years;
Object.defineProperties(this, {
age: {
enumerable:true,
…

micnic
- 10,915
- 5
- 44
- 55
-1
votes
3 answers
How come the compiler asks for initializer before class constructor?
I am creating a class called SelectionPage. Which essentially is a set of menues.
However, when i compile the code, the compiler gives me the following error:
g++ C_Main.cpp C_HomePage.cpp C_SelectionPage.cpp C_MemberManagement.cpp -o…

davidx1
- 3,525
- 9
- 38
- 65
-1
votes
1 answer
Why do memberwise initializers become 'private' when the structure contains a private property?
The default memberwise initializer for a structure type is considered private if any of the structure’s stored properties are private.
(Source: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/accesscontrol/)
What is…

Lyu Hiroyama
- 81
- 5
-1
votes
2 answers
Unable to find a suitable main class, please add a 'mainClass' property -> [Help 1] [ERROR]
I've got a new project from spring boot initializer, the first run he work fine, but the next run i have this error : please add a mainClass,
The project is a spring boot application with kotlin and spring web.
The main class is in the project and i…

mjedli
- 1
- 2
-1
votes
1 answer
Nested object initialiser seems invalid but compiles
If I have the following property with no setter or backing field
public List TestProperty => new List {"one", "two"};
and try to initialise it in an object initialiser using
TestProperty = new List {"three", "four"}
I get…

MFL
- 69
- 1
- 8
-1
votes
1 answer
Setting readonly variables when initializing a generic-type object?
I have the following: a base class SystemBody (which has 3 readonly fields that must be set in the contructor, and never get changed in the object's lifetime), arbitrary derived classes from SystemBody, and the following generic method:
public T…

StarManta
- 1
- 2
-1
votes
2 answers
'Result of initializer is unused error' in SwiftUI
What can I do to fix this error?
Result of 'ForEach' initializer is unused

Frank
- 35
- 1
- 3