| sabi20 (22) | |||
Are you allowed to initialize the private members in the class directly like i did below? ............. because i thought the nothing is created in memory until you create the object..... so can somebody explain this please?
| |||
|
Last edited on
|
|||
| JLBorges (1756) | |
|
> because i thought the nothing is created in memory until you create the object You are right. The = 3.14 is an initializer. When an object is created, constructor(s) can use the information to initialize the member variable (if it has not been explicitly initialized by the code in the constructor). C++11 in-class member initializers http://www.stroustrup.com/C++11FAQ.html#member-init | |
|
|
|