This is covered in the FAQ. Please read FAQ before posting.
I have read the FAQ, and I search it quite often. But this time
I didn't know what to search for. Now I know that I could have
searched for "initializaion", and found FAQ 10.6, but hey, I can't
read the whole FAQ through every time I have a question, can I...?
Just a thought ... how about having a sample C++ program for the FAQ that
contains pointers to relevant topics throughout the code ?
For example (assume prefix http://www.parashift.com/c++-faq-lite/ for
references):
/*** Classes and objects: classes-and-objects.html ***/
class ExampleClass // naming conventions: coding-standards.html#faq-27.11
{
// class members private by default: classes-and-objects.html#faq-7.8
int _privateMember; // naming conventions:
coding-standards.html#faq-27.11
public: // member access (public, private and protected):
basics-of-inheritance.html#faq-19.5
/*** constructors: ctors.html ***/
// default constructor: ctors.html#faq-10.4
// (see also Arrays and default constructors: ctors.html#faq-10.5)
ExampleClass();
ExampleClass(int value)
: _privateMember(value) // initialisation lists vs. assignment:
ctors.html#faq-10.6
{
// inline functions in class body: inline-functions.html#faq-9.8
}
};
It could be hard to know where to put some things, and there could be some
duplication - but this could be way to help people locate pointers into the
FAQ.
Or does something like this already exist ?
David F