Operator overloading
CODE:
CODE:
#include<conio.h>
#include<iostream.h>
class abc
{
int a,b;
public:
abc()
{a=0;b=0;}
abc(int x)
{a=x;b=0;}
abc(int x,int y)
{a=x;b=y;}
void show()
{
cout<<a<<" "<<b<<endl;
}
};
void main()
{
clrscr();
abc obj1;
abc obj2(10);
abc obj3(10,20);
obj1.show();
obj2.show();
obj3.show();
getch();
}For Further Reading,
1 comments:
Awesome. I am a beginner and this article helped me to resolve the problem .Thank
you author and the whole expect team.
http://www.wikitechy.com/view-
article/simple-constructor-overloading-program-in-cpp-with-example
Post a Comment