need help
-
Class A { A() //Constructor } class B: public A { B(...):A(...) {...} . . . } Any body know what is instruction "B(...):A(...)" in class B doing ?
Beginner
- you'll have to speak a better english if you want people here to understand you. 2) when providing a code sample, place it between
<pre></pre>
html tags so that it will be well formatted. 3) a function with the same name as a class is called a constructor. it's purpose is to initalize its members. you should really consider buying a C++ book and learn about object oriented programming...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
- you'll have to speak a better english if you want people here to understand you. 2) when providing a code sample, place it between
-
Class A { A() //Constructor } class B: public A { B(...):A(...) {...} . . . } Any body know what is instruction "B(...):A(...)" in class B doing ?
Beginner
Yes, in the constructor of B, you call the constructor of A. It is usefull for example when you need to pass arguments to the constructor of A.
Cédric Moonen Software developer
Charting control [v1.2] -
Yes, in the constructor of B, you call the constructor of A. It is usefull for example when you need to pass arguments to the constructor of A.
Cédric Moonen Software developer
Charting control [v1.2] -
The second syntax is invalid: the base class (A) needs to be constructed before your child class (B). So the only way to do that is to put it in the constructor initialisation list.
Cédric Moonen Software developer
Charting control [v1.2] -
The second syntax is invalid: the base class (A) needs to be constructed before your child class (B). So the only way to do that is to put it in the constructor initialisation list.
Cédric Moonen Software developer
Charting control [v1.2]