Questions tagged as 'construtor'

1
answer

What is the use of "= delete" in the declaration of a C ++ constructor?

I came across a declared constructor as follows: State(const State& em) = delete; Does anyone know what = delete is at the end of the signature of the counter?     
asked by 22.03.2018 / 19:18
2
answers

What does this () alone do in the constructor?

In the code: public Livro(Autor autor) { this(); this.autor = autor; } public Livro() { this.isbn = "000-00-00000-00-0"; }     
asked by 23.01.2016 / 17:07
2
answers

What is the purpose of a static constructor?

I've always used constructors as follows: public MinhaClasse() { //Algo ... } However, I discovered that in C # it is possible to create a static constructor as follows: public class MinhaClasse { public string Propriedade { get;...
asked by 03.07.2016 / 23:39
2
answers

What is the function of super in a Java constructor?

I have a child class that inherits from another abstract class, and the one in the class constructor has the following: Public aluno(String nome, int idade){ super(nome,idade); } What is the "super" function in the class constructor?  ...
asked by 24.12.2014 / 12:34
1
answer

Is it correct to create a constructor method in an abstract class?

If an abstract class can not be instantiated, creating a constructor method for this abstract class can be considered as good practice or not? If so, what is the reason for creating the implementation of this method? Here is a snippet of code...
asked by 27.09.2015 / 03:43
2
answers

What is the C ++ copy constructor for? How should I implement it?

I am programmer Java and I am currently studying C++ . In addition to the "normal" constructors (the default constructor and the parameterized constructor), C++ has a copy constructor. I would like to know what it is for and...
asked by 27.03.2014 / 18:01
3
answers

Initialize private fields in declaration or constructor?

I'm modeling a class that has a private list and an internal dependency to another object: public class Teste { private IList<string> Textos; private Teste2 Teste2; } I can initialize them in the declaration: private IList&l...
asked by 14.04.2017 / 02:59
1
answer

When should I use __init__ in functions within classes?

From the book I'm studying, at times the author uses __init__ as being a first function of a class. This function (and others) always have self as one of the variables (something that I still do not understand why). When should (an...
asked by 19.01.2016 / 03:04
1
answer

How does the class constructor declaration in Qt?

Work with C and a little assembly on Atmel AVR microcontrollers. I'm trying to understand how the framework extends C ++. I created a new project with Qt Creator (Widgets), and generated the following code: MainWindow::MainWindow(QWidge...
asked by 08.08.2015 / 22:44
1
answer

How does the default Java constructor work?

How is the default Java constructor? Is this? public Pessoa(){ super(); }     
asked by 02.10.2014 / 18:16