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 / guest

Ans. E

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain static and dynamic memory allocation with an example each.

640


Should I learn c++ c?

603


Can constructor be static in c++?

633


What is abstraction with real time example?

612


What is function overloading c++?

566






Which function cannot be overloaded c++?

573


How do you invoke a base member function from a derived class in which you’ve overridden that function?

580


What is c++ flowchart?

671


What are references in c++?

650


Explain the isa and hasa class relationships.

587


what is VOID?

627


What is the difference between *p++ and (*p)++ ?

771


How does com provide language transparency?

600


Differentiate between a constructor and a destructor in c++.

558


What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?

601