Write a complete program whose class name is hello and that displays hello, world on the screen.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#include<iostream> using namespace std; // Creating clas class hello { public: void display() { cout << "Hello World"; } }; int main() { hello t4tutorials; // Creating an object t4tutorials.display(); // Calling function return 0; } |
Output
Hello World
Explanation:
Class: hello
user define function: display
built-in function: main
object: t4tutorials