We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

#include <iostream.h>

class Location
{
              int l1;
              int l2;
      public:
              Location();                               
              Location(int lon,int lat);                    
              void view();                              
              Location operator ++();                   
              Location operator --();                   
              void* operator new (size_t size);         
              void   operator   delete( void *   ptr );
              };
              
Location::Location()
                       {
                       l1=0;
                       l2=0;
                       }
 
Location::Location(int lon,int lat)                 
                       {
                       l1=lon;
                       l2=lat;
                       }

void Location::view()
                       {
                       coutendl"Longitude : "l1endl;
                       cout"Latitude : "l2endlendl;
                       }

void* Location::operator new(size_t size)
                       {
                       cout"Overloaded new operator called....." endl;  
                       void *   rtn   = malloc (size ) ;
                       return   rtn;    
                       }

Location Location::operator ++()
                       {
                       ++l1;
                       ++l2;
                       }

Location Location::operator --()
                       {
                       --l1;
                       --l2;
                       }

void   Location :: operator   delete( void *memory )
                       {
                       cout"Overload delete operator called....."endlendl;
                       free( memory );
                       }


main()
      {
       

system("cls");

                       Location l1(10,20), *l2= new Location(30,40);
                      
                       coutendl"Coordinates for Location 1:";
                       l1.view();
                       ++l1;                                       
                       cout"After applying overloaded ++ operator on Location 1 : ";
                       l1.view();  
                       cout"Coordinates for Location 2:";
                       l2[0].view();             
                       --l2[0];                      
                       cout"After applying overloaded -- operator on Location 2 : ";
                       l2[0].view();          
                       delete l2;
system("pause");

}



+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 2212

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

greet jazakallah

Good Work Brother

well done but one problem occur when it compiled and further continue when press any key. plz make it clear to me. thanx

AOA, bhaai MashaALLAH good work but compilation main error arahay hain please is ko clear kardain.

Thank u so much bhaiya..... but i need ur help to learn c++ its quire difficult 4 me to solve an assignment.i hope u will guide me..

 

now its compile and run fine...

Attachments:

thank u soo much dear................

thanks muzamil

but yah v compile nhi hoo rhi

no need of thanks....if u have any problem with in this file tell me...

thnx broooooooooooooooooo

ye assignment gaalat hai us ne value object k through mange hai laken is me to assignment k through dia hai value

RSS

Latest Activity

Taiba Rajput joined + M.Tariq Malik's group
18 minutes ago
+"Mission Impossible"++ replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion The World's most expensive Proposal
19 minutes ago
+"Mission Impossible"++ liked + "αяsαℓ " Ќąƶµяɨ •"'s discussion The World's most expensive Proposal
20 minutes ago
+"Mission Impossible"++ liked +Umar Amin+'s discussion Happy Birthday to my sweet and lovely friend mmm
21 minutes ago
Taiba Rajput liked + M.Tariq Malik's group IT430 E-Commerce
25 minutes ago
Taiba Rajput joined + M.Tariq Malik's group
27 minutes ago
M. Umair Shahid left a comment for Sami
30 minutes ago
+ Iuuoɔǝut + posted videos
49 minutes ago
Profile IconTalha Asad, MUHAMMAD SALMAN, FIDA MUHAMMAD KHAN and 9 more joined Virtual University of Pakistan
51 minutes ago
MUHAMMAD SALMAN liked Noorfatima's profile
1 hour ago
+ ! ❤️ ░S░I░N░G░E░R liked + ! ! ! ! ! MySterIouS's discussion ~ Khoobsorat Ahsaas ~
2 hours ago
+ ! ! ! ! ! MySterIouS posted a discussion
3 hours ago
+ ! ! ! ! ! MySterIouS replied to + Iuuoɔǝut +'s discussion Phly Dosti phir mohabbat ......
3 hours ago
+ ! ! ! ! ! ! BLaiRe ! !+ replied to +Umar Amin+'s discussion Happy Birthday to my sweet and lovely friend mmm
4 hours ago
+ ! ! ! ! ! ! BLaiRe ! !+ liked +Umar Amin+'s discussion Happy Birthday to my sweet and lovely friend mmm
4 hours ago
彡Tweety彡 ❤️ replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion The World's most expensive Proposal
6 hours ago
彡Tweety彡 ❤️ replied to + Iuuoɔǝut +'s discussion Phly Dosti phir mohabbat ......
6 hours ago
KAMRAN replied to + M.Tariq Malik's discussion MGT611 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 14-11-2019 in the group MGT611 Business & Labor Law
7 hours ago
+ Abb@s replied to + Iuuoɔǝut +'s discussion Phly Dosti phir mohabbat ......
7 hours ago
Profile IconKAMRAN and kiran ashraf joined + M.Tariq Malik's group
7 hours ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service