We all know what a class is, refer the Syntax part
Class definition syntax (in a .h file)
class Name {
// Members can be functions (methods) or data (variables)
public:
// public member declarations and definitions go here
private:
// private member declarations and definitios go here
}; // class Name
Class member function definition syntax (in a .cc file)
// Class member function can be:
// 1) define within the class definiton
// or
// 2) declare within the class definition and then define elsewhere
retType Name::FunctionName(type1 param1, ..., typeN paramN) {
// body statements
}
It’s a little more complex than in C when modularizing with struct definition:
Unlike Java, C++ does not enforce file names, you can name files anything you want
A constructor initializes a newly instantiated object
C++ will automatically create a synthesized default constructor if you have no user-defined constructors