class Foo {
public:
Foo(int i) { }
};
class Bar : virtual Foo {
public:
Bar() { }
};

Bar b;

Referring to the above code, when the object 'b' is defined,
a compiler error will occur. What action fixes the compiler
error?
a) Adding a virtual destructor to the class Bar
b) Adding a constructor to Bar which takes an int parameter
c) Adding "Foo()" to the Bar constructor
d) Adding a copy constructor to the class Foo
e) Adding "Foo(0)" to the Bar::Bar initializer list

Answer Posted / man

class Foo {
public:
Foo(int i) { }
};
class Bar : virtual Foo {
public:
Bar():Foo(0) { }
};

Ans e

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is overriding possible in c++?

570


Explain function overloading and operator overloading.

617


What are c++ variables?

535


What is pointer to array in c++?

615


What does return 0 do in c++?

576






Why is c++ still best?

552


Define pre-condition and post-condition to a member function in c++?

658


What is the rule of three?

566


Define basic type of variable used for a different condition in C++?

662


Difference between Abstraction and encapsulation in C++?

577


What is the difference between while and do while loop?

554


What apps are written in c++?

604


What is c++ mutable?

700


If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?

588


What is a constructor in c++ with example?

576