GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 154 of 203    Print  
What happens to the member function in the class when copy constructor is invoked?

  
Total Answers and Comments: 3 Last Update: July 03, 2008     Asked by: vidya 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: bishoy
 
Member functions, not as a lot of people expect; have only one instance loaded in memory when the program is run. All constructors included copy constructor target loading member variable, but member functions have their single instances always loaded in memory and ready to be called.

Above answer was rated as good by the following members:
YaelG
November 26, 2007 01:22:32   #1  
vinod kumar        

RE: What happens to the member function in the class w...
Only member function should have authority to invoke any other member function.
But constructor is used to initialise the values to data members. they are constant it cannot be invoked any other constuctor. If they are copied compiler should not understand what is member function and what is constructor so ambiquity will be raised.

 
Is this answer useful? Yes | No
January 10, 2008 05:22:51   #2  
bishoy Member Since: January 2008   Contribution: 2    

RE: What happens to the member function in the class when copy constructor is invoked?
Member functions not as a lot of people expect; have only one instance loaded in memory when the program is run. All constructors included copy constructor target loading member variable but member functions have their single instances always loaded in memory and ready to be called.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
July 03, 2008 09:46:43   #3  
sivakumar.v Member Since: July 2008   Contribution: 4    

RE: What happens to the member function in the class when copy constructor is invoked?
Well the basic answer is not possible to call copy constructor explicitly within a function again. Because in the member function it tries to shadow the parameter which is defined at the caller side.

Hence we cannot invoke copy constructor inside a function.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape