Constructors of Members
class complex {
public:
complex(float r);
complex(float r, float i);
};
class circuit {
private:
complex voltage;
complex current;
float capacitance;
char *name;
public:
circuit() : voltage(1.0, 2.0) , current (3.0, -4.0) { /* … */ }
};
Note this differs from the previous example because circuit uses complex, and is not derived from complex
Previous slide
Next slide
Back to first slide
View graphic version