Constructor Initialization
Hi,
Im currently reading a book and its trying to explain why i should use a constructor initialization list. However im not really understanding what its trying to say.
Could anyone please give me an example of what this is trying to explain and what it means?
Quote:
Some variables cannot be initialized with ordinary assignment statements. As a somewhat recursive example, suppose that one of the member variables in your class is an object from some other class. This object should be initialized with a constructor, not a separate function such as init(), so you don’t even have the option of initializing by calling a member function.
Thanks Alot
Kane