Wednesday 28 January 2015

Write a C++ program to show a function of a class showing concept of default arguments.


#include
using namespace std;
class value
{
public:
void show(char='h',int=5); //default arguments
};
void value::show(char y,int x)
{
int i;
for(i=1;i<=x;i++)
cout< cout<<"\n";
}
int main()
{
value a,b,c;
a.show();
//no arguments
b.show(87,2);
//one arguments
c.show('m',3);
//two arguments
}

No comments:

Post a Comment

SAY HELLO!!