We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.


+ Link For Assignments, GDBs & Online Quizzes Solution


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

#include <iostream.h>

class Location
              int l1;
              int l2;
              Location(int lon,int lat);                    
              void view();                              
              Location operator ++();                   
              Location operator --();                   
              void* operator new (size_t size);         
              void   operator   delete( void *   ptr );
Location::Location(int lon,int 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 ++()

Location Location::operator --()

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



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


+ 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)

Views: 2292


Replies to This Discussion

object k through he hai dear..more clarify me ur point ..

but muzamil yah compail ni ho rhi

there is not wrong with this file ..go to first discussion about this assignment u will get the whole idea..

Brother! what the heck "malloc" is? where you did declare this?

malloc and calloc function for allocating a memory ..in this assignment u havce to overload new operator coz object always can allocate the memory by new operator in dynamically..so u have to defined a malloc or calloc function to allocate memory in the definition of overloading new operator ..okay ?

similarly when we are allocating memory by malloc or calloc functions then its our responsibility to free the memory allocated... so u have to overload delete operator for it..

can u plz tell k press enter to continue likhne k liye kon sa code use hota hai aur kahan pe??


Thanks brther!

thanks a lot

complte and 100% correct



Looking For Something? Search Below

Latest Activity

+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ liked + ! ! Pagal Dewani ! ! +'s discussion Ap kase roty hain ....................????
11 minutes ago
+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ liked ★彡[ꜱʜʏɴᴀ]彡★'s discussion usi k naam sey jeena, usi sey merna hai
15 minutes ago
+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ liked ★彡[ꜱʜʏɴᴀ]彡★'s discussion Ke Aaj Raat Chale Gi Hawa Udaasi Ki..
15 minutes ago
+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ liked Omar's discussion Thanks giving
16 minutes ago
+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ replied to +!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓'s discussion ............❤️❤️❤️ASAL Kahaniiiii❤️❤️❤️.........
18 minutes ago
+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ liked ★彡[ꜱʜʏɴᴀ]彡★'s discussion Aksar
19 minutes ago
+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ liked Laila kabeer's discussion !!!!!!!!!! ISHFAQ AHMED!!!!!!!!!!!!!!!!!
32 minutes ago
+!!!★彡 "Å⫶l̊⫶å⫶n̊⫶ "彡★✓ liked + + + + " Tw!nkle "'s discussion Happy HAppy birthday !! FIYA
36 minutes ago
★彡[ꜱʜʏɴᴀ]彡★ posted discussions
4 hours ago
★彡[ꜱʜʏɴᴀ]彡★ replied to + ! ! Pagal Dewani ! ! +'s discussion Ap kase roty hain ....................????
7 hours ago
+ + + + " Tw!nkle " posted a discussion
8 hours ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion ZOO507 Principles of Animal Ecology PPTs Slides With Solved MCQs File in the group ZOO507 Principles of Animal Ecology
9 hours ago

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

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