GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 8 of 63    Print  
while copying the objects if you say X a = b and asssume that '=' operator is overloaded then what it will call, a copy constructor or operator overloading function

  
Total Answers and Comments: 6 Last Update: May 07, 2007     Asked by: Amit Joshi 
  
 Sponsored Links



 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 20, 2005 07:41:23   #1  
Debasis        

RE: while copying the objects if you say X a = b and a...
NC
 
Is this answer useful? Yes | No
October 21, 2005 02:10:12   #2  
chandan        

RE: while copying the objects if you say X a = b and a...
operator overloading
 
Is this answer useful? Yes | No
October 21, 2005 02:50:06   #3  
rajkishore        

RE: while copying the objects if you say X a = b and a...
while doing X a=b; in this statement what it will do first create the object 'a' then it will copy the value of 'b' to ' a'. so the copy constructure will call.
 
Is this answer useful? Yes | No
February 01, 2006 09:57:02   #4  
Rahul Vij        

RE: while copying the objects if you say X a = b and a...

X a=b is internally represented as X a(b). The compiler will call a copy constructor and not the overloaded = operator. as for theoperator to be called the LHS object should have been instantiated before the call. but in the above case it is getting instantiated in the same call. so copy constructor will be called doing a shallow copy. a standard one will be generated by the compiler only


 
Is this answer useful? Yes | No
October 23, 2006 17:51:54   #5  
vijay saxena        

RE: while copying the objects if you say X a = b and a...

constructor will first call. becs this function invoked when new object is created so it first look for constructor rather than go for operator overloading.

vijay


 
Is this answer useful? Yes | No
May 07, 2007 07:30:16   #6  
Sunny        

RE: while copying the objects if you say X a = b and a...
Definitly the constructor should be invoked, but can "=" be overloaded ? i doubt it cannot.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links



 
Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape