Topic: Proposal: Initialization of Class Members within Class Definition
Author: dummy@dummy.com (Jim Dye)
Date: Tue, 17 Jan 2006 04:32:27 GMT Raw View
I would like to see something like:
class XYZZY
{
..
SOMETYPE *ptr = 0 ;
} ;
within the class definition to serve as the default initialization of a
member. Such an initialization could be overriden in the constructor.
XYZZY::XYZZY (...)
: ptr (&q)
{
}
Reasoning:
1. This would help eliminate/reduce duplicate initializations in classes
with multiple constructors.
2. Improve reliability by providing a convenient mechanism ensure data
members are initialized and providing a means to verify the initialization.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]