Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Write a C++ program using concept of constructor overloading.
SUBMITTED BY:
Nrupeshsinh
DATE:
June 26, 2016, 4:33 a.m.
FORMAT:
C++
SIZE:
438 Bytes
Raw
Download
Tweet
HITS:
536
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