GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 179 of 203    Print  
C++ Syntax
class ABC {
public:
ABC(int i = 0) {
val = i;}
int GetVal() {return val;}
void SetVal(int i) {val = i;}
private:
int val;
};

void DoubleABC(ABC& abc)
{
abc.SetVal(2 * abc.GetVal());
}

A. There are no problems or compiling errors with this code.
B. There is an error with "void DoubleABC(ABC& abc)" because class ABC does not have a copy constructor.
C. There is a problem because the class ABC does not have a destructor.
D. There is a problem because there is no return type with the constructor "ABC(int i = 0)" in the class ABC.




  
Total Answers and Comments: 3 Last Update: December 17, 2008     Asked by: prettyfox 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: sultankeshwar
 
There is no problem

Above answer was rated as good by the following members:
santhosh.kanchanapally, yzesong
August 14, 2008 04:31:59   #1  
anirudhac Member Since: August 2008   Contribution: 1    

RE: C++ Syntax
answer A
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
December 07, 2008 09:07:36   #2  
burraganesh Member Since: December 2008   Contribution: 20    

RE: C++ Syntax
There is no data member with the name val so compilation error
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
December 17, 2008 02:25:20   #3  
sultankeshwar Member Since: December 2008   Contribution: 1    

RE: C++ Syntax
There is no problem
 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    


 
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