Question:Consider the sample code given below and answer the question that follows.
class SomeClass
{
int x;
public:
SomeClass (int xx) : x(xx) {}
};
SomeClass x(10);
SomeClass y(x);
What is wrong with the sample code above? 

A SomeClass y(x); will generate an error because SomeClass has no copy constructor 

B SomeClass y(x); will generate an error because SomeClass has no default constructor 

C SomeClass y(x); will generate an error because SomeClass has no public copy constructor 

D x(xx) will generate an error because it is illegal to initialize an int with that syntax 

E The code will compile without errors 

+ Answer
+ Report
Total Preview: 6900

Copyright © 2024. Powered by Intellect Software Ltd