class MyClass {
  public:
    int myNum;
    string myString;
    void myMethod() {  // Method/function defined inside the class
      cout << "Hello World!" << endl;
    }
};
MyClass myObj;  // Create an object of MyClass
myObj.myMethod();  // Call the method
Comments