This program defines a class called MyClass with two member variables, num and str of type int and string respectively. In the main() function, an object obj of MyClass is created and its member variables num and str are initialized with values 15 and "Tutor Joes". The values are then printed to the console using cout.
#include<iostream> using namespace std; class MyClass { public: int num; string str; }; int main() { MyClass obj; obj.num = 15; obj.str = "Tutor Joes"; cout<<obj.num<<"\n"; cout<<obj.str; return 0; }To download raw file Click Here
15 Tutor Joes
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions