How to order my objects in a C++ class correctly
- by Julen
Hello,
I have been coding regurlarly in C++ in the past months. I am getting used to it step by step... but there are things that confuse me about formatting.
I know there is a lot of legacy from C that I supousee mixes with C++. This time I have doubts about how to order properly my members and functions within in a class. Also considering their access modifiers.
How is the convention in this? Until know I am doing everything "public" and writing first constructor of class, then destructor, next members and finally functions. It this correct? What happens when introducing "private" and "protected" access modifiers or "virtual" functions?
From the documents I have look in the Internet there is different ways of doing things. But my questions aims to get the knowledge from a community that develops in C++ that I want to blend into. ;-)
Thanks a lot!!!