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
Is overriding possible in c++?
Explain function overloading and operator overloading.
What are c++ variables?
What is pointer to array in c++?
What does return 0 do in c++?
Why is c++ still best?
Define pre-condition and post-condition to a member function in c++?
What is the rule of three?
Define basic type of variable used for a different condition in C++?
Difference between Abstraction and encapsulation in C++?
What is the difference between while and do while loop?
What apps are written in c++?
What is c++ mutable?
If a base class is an adt, and it has three pure virtual functions, how many of these functions must be overridden in its derived classes?
What is a constructor in c++ with example?