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


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

#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: 2264

.

+ 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

مخلص posted a discussion
22 minutes ago
sabir khan posted a discussion
25 minutes ago
LILY replied to LILY's discussion HAPPY INDEPENDENCE DAY
25 minutes ago
LILY replied to LILY's discussion HAPPY INDEPENDENCE DAY
26 minutes ago
M. Haris liked Naaz Bajwa's profile
28 minutes ago
M. Haris updated their profile
1 hour ago
Bilal joined +M.Tariq Malik's group
2 hours ago
Muhammad Bilal liked zohaib iftikhar's discussion ...* KIA NAMAZ MAIN KISI KO SALAM KRNY SY NAMAZ TOOT JATI HAI?...*
8 hours ago
zohaib iftikhar replied to zohaib iftikhar's discussion ...* NA SABOOT HAI NA DALEEL HAI...*
8 hours ago
zohaib iftikhar replied to zohaib iftikhar's discussion ...* KIA NAMAZ MAIN KISI KO SALAM KRNY SY NAMAZ TOOT JATI HAI?...*
8 hours ago
zohaib iftikhar liked zohaib iftikhar's discussion ...* KIA NAMAZ MAIN KISI KO SALAM KRNY SY NAMAZ TOOT JATI HAI?...*
8 hours ago
zohaib iftikhar posted discussions
8 hours ago
Muhammad Bilal liked zohaib iftikhar's discussion ...* SUNO ...SUNO NA!...*
8 hours ago
Muhammad Bilal replied to zohaib iftikhar's discussion ...* NA SABOOT HAI NA DALEEL HAI...*
9 hours ago
Muhammad Bilal liked zohaib iftikhar's discussion ...* NA SABOOT HAI NA DALEEL HAI...*
9 hours ago
Muhammad Bilal replied to Shanzay's discussion Sab Rasmii Rasmii Batain Hain...!!!
9 hours ago
Muhammad Bilal liked Shanzay's discussion Sab Rasmii Rasmii Batain Hain...!!!
9 hours ago
Muhammad Bilal replied to LILY's discussion HAPPY INDEPENDENCE DAY
9 hours ago
Muhammad Bilal liked LILY's discussion HAPPY INDEPENDENCE DAY
9 hours ago
Muhammad Bilal replied to Sofia_Khan's discussion Need Cs401 GDB SOLUTION
9 hours ago

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

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

.