belongs to collection: C++ Classes and Object programs
In this program you will learn how to create a class, create object of that class and calling the member function in main function.
/* C++ program to create a simple class and object.*/ #include <iostream> using namespace std; class Hello { public: void sayHello() { cout << "Hello World" << endl; } }; int main() { Hello h; h.sayHello(); return 0; }
Output
Hello World
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Simple class and object creating program in C++
Output
need an explanation for this answer? contact us directly to get an explanation for this answer