Most voted "initialization" questions
28 questions
Sort by count of
-
14
votes2
answers289
viewsNew C# 6 functionality "Auto-Property initializers" is just a facilitator?
One of the new C#6 features is the possibility to initialize properties at the time of declaration. public class Customer { public string First { get; set; } = "Jane"; public string Last { get; set;…
-
13
votes2
answers6067
viewsWhat’s the difference in instantiating, initializing, and declaring a variable?
Many articles on the Internet refer to these verbs, regardless of the programming language. But sometimes they are all confused or exchanged, which creates a lot of confusion. Which means…
variables terminology variable-declaration language-independent initializationasked 7 years, 9 months ago vinibrsl 19,711 -
7
votes2
answers116
viewsWhat happens when we assign the default value to objects?
Example: public Carro Metodo(string marca) { Carro carro = default; if(!string.IsNullOrEmpty(marca)) { carro.Marca = marca } return carro; } Studying on the Internet, I realized that some objects…
-
5
votes1
answer143
viewsWhy are instance variables usually initialized in the constructor?
I have seen several codes where the instance variables of a class are initialized in the constructor, even I do it myself by watching others do it. But I never understood it. Logical that has the…
-
4
votes1
answer506
viewsVariable without initializing
I did a basic function of squaring (exercise of a book), and I use a variable named aux and the use to calculate the power value squared, but the compiler claims that aux is not initialized, I would…
-
4
votes1
answer1504
viewserror: initializer element is not Constant
I’m trying to declare this buffer overall and when compiling it presents the following error error: initializer element is not Constant char *ls_buffer_PPouAUT = malloc(5120*sizeof(char)); How can I…
-
4
votes2
answers607
viewsWhat is the difference between initializing a constructor or doing attribution within the constructor?
What is the difference between the two examples below? I should also assign the value within the constructor in this class even if I initialized? example 1: class sof{ int teste; public: sof(int t)…
-
4
votes1
answer173
viewsInitialization of attributes
Is there any difference between initializing an attribute like this: public class Turma { private List<Aluno> alunos = new ArrayList<Aluno>(); } Or so: public class Turma { private…
-
4
votes1
answer350
viewsHow to initialize an array in this constructor?
I’m trying to initialize a array with 0, however the compiler is generating error, I know I can initialize as well: Constructor() : Value1(0), Value2(0), Initialized(false), vSh(false) { Name[100] =…
-
3
votes1
answer52
viewsName of field or Property being initialized in an Object initializer must start with '.'
Give me the error: The name of the field or property being initialized on an object initializer must start with '.'. Private myImageList As System.Windows.Forms.ImageList = New ImageList() Private…
-
3
votes2
answers626
viewsWays to initialize struct’s
I know these two ways to boot struct's. #include <stdio.h> typedef struct { char s[10]; int a, b; double x; } TIPO; int main(){ TIPO v1[10]={"foo", 5, 13, 4.3, "bar", 0, 0, 2.3}; TIPO…
-
2
votes1
answer797
viewsOrder of class initialization/instantiation
class Bird { { System.out.print("b1 "); } public Bird() { System.out.print("b2 "); } } class Raptor extends Bird { static { System.out.print("r1 "); } public Raptor() { System.out.print("r2 "); } {…
-
2
votes1
answer2466
viewsEmpty list matrix initialization "{ }" in C++
From what I have seen, it is possible to initialize a vector with the empty list, in C++, but not in C, so that all vector elements are 0: int meuVetor[10] = {}; // Todos os elementos 0, em C++ What…
-
2
votes1
answer614
viewsVBA events in Powerpoint
Hello, Is there any event in Powerpoint that allows the execution of a subroutine when selecting a slide. For example, the presentation is running... When you get to slide 120 it has to run a…
-
2
votes1
answer32
viewsInitialization of variables in Java
Good night Folks! I’m learning java, and if you can help me with that question,... I saw it in a course that I’m doing, in a book that I’m reading, and on websites where I researched this assuming…
java variables typing initialization programming-principlesasked 3 years, 3 months ago Tarcio Vinicius Nieri 73 -
1
votes1
answer43
viewsError declaring a matrix
I made a matrix[day][time], but I get error when initializing it. I get that mistake and I don’t know how to fix it error: expected ':', ',', ';', '}' or 'attribute' before '=' token The code is…
-
1
votes1
answer5830
viewsHow to run shell commands on debian startup?
I need you to call my Raspberry pi 3 for it to execute the following scripts: $cd ~/Desktop $source ~/.profile $workon cv $python raspberry.py only that, then it will already run my program…
-
1
votes2
answers100
viewsString compilation problem in C
I’m trying to compile this code into C: #include<stdio.h> #include<string.h> #define tam 100 typedef struct TipoAluno{ char nome[50]="A"; char curso[50]="B"; char cota[50]="C"; int…
-
1
votes0
answers19
viewsAutomatic Startup of Programs
Well, I have two programs one written in JAVA that queries a database and and generates an xml, and another written in C++ that traverses the xml generated by the java program. I wonder if there is…
-
1
votes0
answers20
viewsWhat are the members' initialization lists and under what circumstances should they be used?
What is the purpose of a member initialization list that is used in class/struct constructors in the C++ language and under what circumstances it should be used.
-
0
votes1
answer59
viewsDoubt about the Initializer block
I’d like to know why the code compiles but does not execute? Follows the code: package exemploinicializador2; public class ExemploInicializador2 { private String nome = "Aurélio"; private String…
-
0
votes2
answers1575
viewsHow to run file . vbs on Windows Start
As I could run a file . vbs when windows start, I can make a file . bat run by regedit. I already put a . bat to open . vbs, I did so cscript "C:\teste.vbs" exit…
-
0
votes2
answers98
viewsCS0847 error in matrix code in C#
I’m making a simple matrix code in C# to display string values, only it appears CS0847 Error: Matrix initializer of length "3" on line 9 and did not understand what it means. using System; namespace…
-
0
votes1
answer10
viewsInitialization list of members with attributes from another class (inheritance)
I know a member startup list declares and at the same instant initializes such an attribute(s), that’s what I know so far. In the following code: #include <iostream> // std::cout class Foo {…
-
-1
votes2
answers74
viewsJava running 2 programs in parallel
I’m using intellj and I just started a free course. I challenged myself to make a code in which you put a date and the program says the day of the week, but when trying to run the code opens a small…
-
-1
votes1
answer45
viewsjava.lang.Nullpointerexception error even with instantiated and initialized object
Good afternoon, In the code below I have already entered the Supplier class within the main Product and even so continues the error below, Can someone help me fix and explain why it’s wrong so…
java classes nullpointerexception instantiate-object initializationasked 4 years, 4 months ago Deivson Bezerra 149 -
-2
votes2
answers143
viewsInstantiating a class as being property of another class
I have the classes: using System; namespace Model { public class Profissionais { public int idProfissional { get; set; } public String Nome { get; set; } public String CPF { get; set; } public…
-
-6
votes1
answer150
viewsIs it possible to delay the initialization of a constant?
With delay initialization, I say initialize a constant after your declaration. For example (pseudocode): const exemplo; exemplo = 2;
variables language-independent constant initializationasked 4 years, 11 months ago NinjaTroll 1,752