C++ Rules For Classes And Numbers

Learn about good programming practices for C++ regarding classes, containers, integers, and floating point numbers.

Classes

  • Differentiate between class and struct, though the only formal difference between them is whether fields are public by default or not. Use struct when you need a bunch of public fields with no non-trivial methods. Use class as a bunch of private fields with methods processing them. The following is an example of struct:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.