Monday, December 12, 2011

[Cpp-Programming] Re: Inheritance and termination housekeeping

In C++ you have declarations and initialisations of variables:

int a; // declaration
a = 42; // first assignment, or "initialisation" of a

int b = 13; // declaration + initialisation

where "int b = 13;" may also be written as "int b(13);" which does
exactly the same, but is called "constructor initialization"
as a reference see under section "Initialization of variables" here:
http://www.cplusplus.com/doc/tutorial/variables/

for members of a class the concept of constructor initialisation is
used in constructor initialisation lists
as a reference see here: http://www.learncpp.com/cpp-tutorial/101-constructor-initialization-lists/

I find it good practice to use constructor initialisation lists.
And as a rule of thumb: always initialise your pointers (to allocated
memory or NULL) ;-)

--
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to cpp-programming@googlegroups.com.
To unsubscribe from this group, send email to cpp-programming+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cpp-programming?hl=en.

0 Comments:

Post a Comment

<< Home