class data {
public:
double x, y, z, blah;
data ();
};
with the constructor:
1 2 3 4 5 6
data::data () {
x = 0;
y = 0;
z = 0;
blah = 1;
}
In another class (and constructor), the data class is used:
1 2 3 4 5 6 7 8
class otherclass {
public:
// other variables
data moardata;
otherclass () {
//constructing class
}
};
would I need to construct moardata.x, moardata.y, etc if I wanted them to be zero? Or would the constructor for data affect each member declared in otherclass?