//Sample Program to overload functions
#include < iostream.h >
#include < conio.h >
class arithmatic
     {
     int i,j,k;
     public:
	  void arith(int m,int n)
	  {
	   cout << "\n Function arith is called with two parameters\n\n";
	   i=m;
	   j=n;
	   k=i + j;
	   cout << " i= "<< i << " j=  " << j << " Sum= " << k << endl;
	   }
     void arith (int a,int b,int c)
	 {
	 int t;
	 cout << "\n Function arith is called with three parameters\n\n";
	 i=a;
	 j=b;
	 k=c;
	 t= i + j + k;
	 cout << " i= " << i << " j= " << j << " k= " << k << " Sum=  " << t << endl;
	 }

       };
       void main()
       {
	arithmatic a1,a2;
	clrscr();
	a1.arith(5,6);
	a2.arith(5,6,7);
	getch();
	}
<< GO BACK

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus


Footer1