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

Why do we use classes in programming?

0 Answers  


Why seem interrupt handlers as member functions to be impossible?

1 Answers  


What is an associative container in c++?

0 Answers  


program in c++ to input digits and print in words

1 Answers   Microsoft,


In C++ cout is: a) object b) class c) something else

11 Answers   Infosys, Lehman Brothers,


How does throwing and catching exceptions differ from using setjmp and longjmp?

1 Answers  


Explain rethrowing exceptions with an example?

0 Answers  


How static variables and local variablesare similar and dissimilar?

0 Answers  


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

0 Answers  


Explain one method to process an entire string as one unit?

0 Answers  


What is flush c++?

0 Answers  


What is unary operator? List out the different operators involved in the unary operator.

0 Answers  


Categories