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

Answers were Sorted based on User's Feedback



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

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

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

Answer / guest

Ans. E

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is the header file for setw?

0 Answers  


Explain binary search.

0 Answers  


What is an Iterator class?

1 Answers  


What do you mean by volatile and mutable keywords used in c++?

0 Answers  


What are dynamic type checking?

0 Answers  






what is data abstraction in C++?

0 Answers  


Difference between delete and free.

0 Answers  


Define inline function

1 Answers  


What is anonymous object in c++?

0 Answers  


What is an iterator class in c++?

0 Answers  


If there are two catch statements, one for base and one for derived, which should come first?

0 Answers  


Can you pass an array to a function in c++?

0 Answers  


Categories