constructor with default arguments
constructor with default arguments
//constructor with default arguments
#include<iostream>
using namespace std;
class Simple {
int data1 ;
int data2;
public :
Simple(int a,int b)
{
data1=a;
data2=b;
}
void printData();
};
void Simple :: printData()
{
cout<<"the value of data is "<<data1<<" and "<<data2<<endl;
}
int main()
{
Simple s( 12, 54);
s.printData();
return 0;
}
Comments
Post a Comment