Sunday, 14 April 2013

DEFAULT ARTGUMENTS IN MEMBER FUNCTION C++ PROGRAMMING LANGUAGE

/*
  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :::: THIS PROGRAMM EVALUTE THE CONCEPT OF DEFAULT ARTGUMENTS       ::::
  :::: IN MEMBER FUNCTION    C++ PROGRAMMING LANGUAGE                ::::
  :::: DEVLOPED BY DX PANCHAL AT GROW MORE M.C.A. LAB                ::::
  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

*/
// HEADER FILE DECLARATION
#include<iostream.h>
#include<conio.h>
#include<dos.h>

//CLASS TEST DECLARATION
class test
{

  int a,b,ans;

  public:
     void setcode(int m,int n=10)
     {
       a=m;
       b=n;
       ans=a+b;
       cout<<"\n\n\t\tVALUE OF A+B = "<<ans;
     };


};
// END OF CLASS TEST

// MAIN FUNCTION SECTION

void main()
{
  clrscr();
  test t1;
  t1.setcode(15); //TAKES DEFAULT VALUE
  t1.setcode(20); //TAKES DEFAULT VALUE
  t1.setcode(25,5);//GIVES VALUE TO THE FUNCTION




 getch();
}

No comments:

Post a Comment

How to change Background color by selecting color from Listview

activitymain.xml file::> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xm...