Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Please discuss about the assignment!


Problem Statement:     Location Calculation     


You are required to write a program for calculating location somewhere on the map. There are two parameters (coordinates) used in calculating a location. One is longitude and the other is latitude. You need to overload ++, --, new and delete operators for this.


Detailed Description:


  • You are required to create a class named Location.
  • It will have two private data member longitude and latitude.
  • These data members will be assigned values through constructor parameters. For example obj1(20,30).
  • Overloaded ++ operator will increase the both longitude and latitude values by one, overloaded -- will decrease both by one.
  • By overloading new operator, you will allocate the memory dynamically for the object of class Location.
  • The overloaded delete operator will free (de-allocate) the allocated memory.
  • You have to create two objects of class Location. One object will be created through overloaded new operator and other will be created without it.
  • A message “Overloaded new operator called”, embedded inside overloading function for new operator, should be displayed when the object is created through new operator.
  • Similarly, a message “Overload delete operator called” should be displayed upon calling overloaded function of delete operator.
  • Assign the values (10, 20) and (30, 40) for longitude and latitude for object 1 and 2 respectively.

Views: 5609


Replies to This Discussion

Thanx Yasir bhai. Allah taala apko khush rakhay. Ameen. So nice of u

Yasir bhai last output ki line " Overload delete operator kaisay aay gi"? kia last fun delete say pahlay kch likhna pahray ga

Plz guide for last time???

Write cout

dekho yar agr ap logo ko pointer pe achi grip hoti tu ap ye problem kuch sec me ksolve kar was very easy..

++operator overloading reference pe ho rha tha bs ap ne usy dereference krna tha..

well all thanks for yasir bhai..

please ager bata sakty ho to tell me is may kia problem hay


Dear nadeem aik to apne Longitude aur latutude ki values cout nai ki. 2ra apne pointer increment k sath nai lgaya jo yasir bhai nay mention kia tha

use free in overloaded delete operator and use & to defrence 

no perfect solution...!!!

Tahir bhai iss main kia problem ha. i think its almost right. Can u locate any error???Plzzzz


give me source file, there are no errors in display,,,,!!!

Find the diffrence...!!!!



Looking For Something? Search Below

Latest Activity

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

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