uncomment line 16 output is 15. Comparing line 17 and 14-15, the later is optimized for performance.
differences in using dot operator. and pointer operator->
If you have a pointer to an object, the pointer operator would be best suited. If you have instantiated an object as a local variable on the stack, then the dot operator is best suited.
Q:
All my class members are private, and my class does not contain any declared friend class or function. Who can access these members?
A:
None except member methods of the same class ref 1
members of a class are private by default as opposed to those in a struct
e.g.
1 2 3 4
classHuman { int Age;//Age is private };
contrarily
1 2 3 4
structHuman { int Age;// Age is public };
A programme for calculating area and circumference of a circle