Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Write a C++ program using concept of constructor overloading.
SUBMITTED BY:
Nrupeshsinh
DATE:
June 30, 2016, 2:26 p.m.
FORMAT:
Text only
SIZE:
438 Bytes
Raw
Download
Tweet
HITS:
371
Go to comments
Report
# include<iostream.h>
# include<conio.h>
class myclass
{
public:
int a,b;
myclass()
{
a=10;
b=20;
}
myclass(int a1)
{
a=a1;
b=30;
}
myclass(int a1,int b1)
{
a=a1;
b=b1;
}
void put()
{
cout<<"A="<<a<<endl;
cout<<"B="<<b<<endl;
}
};
void main()
{
clrscr();
myclass m1;
myclass m2(40);
myclass m3(50,60);
m1.put();
m2.put();
m3.put();
getch();
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus