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

Is turbo c++ free?

0 Answers  


Is overriding possible in c++?

0 Answers  


What are the rules for naming an identifier?

0 Answers  


What is the main purpose of c++?

0 Answers  


Why we use #include iostream in c++?

0 Answers  






What is a modifier in c++?

0 Answers  


Why preincrement operator is faster than postincrement?

5 Answers  


Is swift faster than go?

0 Answers  


What is binary search in c++?

0 Answers  


What is pure virtual function? Or what is abstract class?

0 Answers  


How does java differ from c and c++?

0 Answers  


Can I learn c++ in a week?

0 Answers  


Categories