Search This Blog

Monday, 12 November 2012

Overloading the comma operator

#include<iostream.h>
#include<conio.h>
#include<alloc.h>
#include<stdlib.h>
class loc{
int longitude,latitude;
public:
loc(){}
loc(int lg,int lt){
longtitude=lt;
}
void show()
{
cout<<longtitude<<"";
cout<<latitude<<"";
}
loc loc::operator,(loc op2)
{
loc temp;
temp.longtitude=op2.longtitude;
temp.latitude=op2.latitude;
return temp;
}
};
main()
{
clrscr();
loc ob1(10,20),ob2(4,6),ob3(1,1);
ob1.show();
ob2.show();
ob3.show();
ob1=(ob1,ob2,ob3);
ob1.show();
getch();
}

Output:
10 20
46
11
11


5 comments:

  1. 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

    ReplyDelete
  2. Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.


    Best PHP Training Institute in Chennai|PHP Course in chennai

    Best .Net Training Institute in Chennai
    Matlab Training in Chennai

    Embedded Training in Chennai

    SAS Training in Chennai

    ReplyDelete
  3. Subscription boxes are a type of boxes which are delivered to the regular customers in order to build goodwill of the brand. They are also a part of the product distribution strategy. As a woman, you should subscribe to these boxes to bless yourself with a new and astonishing box of happiness each month. visit mysubscriptionsboxes

    ReplyDelete
  4. Nice Articles!!!Concepts are very clear Now...The information's about Matlab Training is Good...Here The Kind of information's for you...
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete