Creating an Object
MyClass myObj; // Create an object of MyClass
myObj.myNum = 15; // Set the value of myNum to 15
myObj.myString = "Hello"; // Set the value of myString to "Hello"
cout << myObj.myNum << endl; // Output 15
cout << myObj.myString << endl; // Output "Hello"
Comments