Important Questions

C++ Program to print "Hello World" using Class

//C++ program to print "hello world" using class
//header files
#include<iostream.h>
#include<conio.h>

//creating class
class Message
{
public:

void display()
{
cout<<"Hello World";
}

};
void main()
{

Message a;      //creating object
a.display();       //calling the functionl
getch();

}
//now run the program using ctrl+f9

Output


You can also see a video how to run this program