Sunday, February 27, 2011

Function Overloading using Classes

#include<iostream.h>
#include<conio.h>
 class demo
 {
 public:
 void fun()
 {
 cout<<"\n This is a demo 1";
 }

void fun(char *i)
 {
 cout<<"\n This is a demo "<<i;
 }
 };

void main()
 {
 clrscr();
 demo obj;
 obj.fun();
 obj.fun("Hello ");
 getch();
 }

No comments:

Post a Comment