class MyClass {
  public:
    int myNum;
    string myString;
    MyClass() {  // Constructor
      myNum = 0;
      myString = "";
    }
};
MyClass myObj;  // Create an object of MyClass
cout << myObj.myNum << endl;         // Output 0
cout << myObj.myString << endl;      // Output ""
Comments