Example
#include < iostream.h >
#include < conio.h >
class test{
      int i,j,k,sum;
      public:
      void add(int a, int b, int c=77)
	     {
	     i=a;
	     j=b;
	     k=c;
	     sum=i+j+k;
	     cout <<  "\n\n Sum is : " << sum;
	     }
      };
      void main()
      {
      test t1,t2;
      clrscr();
      cout << "\n\n Example for Default arguments";
      t1.add(22,33,44);
      t2.add(58,56);
      getch();
}
<< GO BACK

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus


Footer1