Operator Overloading:- Operator Overloading provides option for creation of new definition of Operators.Operator overloading provide specia...
Operator Overloading:-Operator Overloading provides option for creation of new definition of Operators.Operator overloading provide special meaning to most of the operator like =,+,-,*,=+,== etc. but expect some operator.It is used in c ++,java,c#(c sharp) etc.
Some exception operators are:-
1)Scope Resolution Operator(::)
2)Sizeof operator
3)Conditional Operator(?:)
4)Class member access point
5)Value of (*.)
Example:-Write a program to overload the unary operator "-"(you can also overload binary operator).
# include<iostream.h>
void<conio.h>
class xyz
{
int p,q,r;
public:
void get();
void put();
void operator-();
};
void xyz::get()
{
cout<<"enter no.";
cin>>p>>q;
}
void num::put()
{
cout<<p<<q<<r;
}
void xyz::operator-()
{
p=-p;
q=-q;
r=-r;
}
void main()
{
xyz x; //object
clrscr();
x.get();
x.put();
-x;
x.put();
getch();
}
That's all about Operator Overloading(in oops and data structure).
Some exception operators are:-
1)Scope Resolution Operator(::)
2)Sizeof operator
3)Conditional Operator(?:)
4)Class member access point
5)Value of (*.)
Example:-Write a program to overload the unary operator "-"(you can also overload binary operator).
# include<iostream.h>
void<conio.h>
class xyz
{
int p,q,r;
public:
void get();
void put();
void operator-();
};
void xyz::get()
{
cout<<"enter no.";
cin>>p>>q;
}
void num::put()
{
cout<<p<<q<<r;
}
void xyz::operator-()
{
p=-p;
q=-q;
r=-r;
}
void main()
{
xyz x; //object
clrscr();
x.get();
x.put();
-x;
x.put();
getch();
}
That's all about Operator Overloading(in oops and data structure).
If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.
You made some good points there. I did a search on the topic and found most people will agree with your blog.Python Training in Chennai
ReplyDeleteInfycle Technologies, the best software training institute in Chennai offers the best AWS training in Chennai for tech professionals. Apart from the AWS Course, other courses such as Oracle, Java, Hadoop, Digital Marketing, Selenium, Big Data Android, and iOS Development, DevOps and Azure will also be trained with 100% hands-on training. Dial 7502633633 to get more info and a free demo.
ReplyDelete