Write a cpp program to print "Hello World!" using class and object?

#include<iostream.h>
#include<conio.h>
class HelloWorld
{
 public:
  void fun()
  {
  cout<<"Hello World!";
  }
}
void main()
{
 clrscr();
 HelloWorld obj;
 obj.fun();
 getch();
}

Ourput:


Comments

Popular posts from this blog

Larch Soft Pvt. Ltd. - Best Website & Hosting Provider