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

In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that

618


Is c++ still in demand?

640


How do you establish a has-a relationship?

612


Is c++ fully object oriented?

553


List the features of oops in c++?

578






What is the error in the code below and how should it be corrected?

312


What programming language should I learn first?

594


What is &x in c++?

561


What do you mean by friend class & friend function in c++?

622


What are proxy objects in c++?

645


Is it possible to have a recursive inline function in c++?

560


Give an example of run-time polymorphism/virtual functions.

568


If dog is a friend of boy and boy is a friend of house, is dog a friend of house?

557


What is difference between malloc()/free() and new/delete?

651


What are the comments in c++?

576