1
Is there a difference when initializing a variable in any of these constructor forms? And how do I default a constructor (default) in a class that has more than one constructor?
Constructor 1:
class Teste
{
private:
int valor1, valor2;
float valor3;
public:
Teste(void) : valor1(0), valor2(0), valor3(0.f) {}
};
Constructor 2:
class Teste
{
private:
int valor1, valor2;
float valor3;
public:
Teste(void)
{
valor1 = 0;
valor2 = 0;
valor3 = 0.f;
}
};
Currently I prefer to use the method of constructor 1 because I find cleaner, changes in something?
Related: https://answall.com/q/248436/64969
– Jefferson Quesado