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
What is data types c++?
Give an example of run-time polymorphism/virtual functions.
Explain differences between alloc() and free()?
Should I learn c or c++ or c#?
Explain what is oop?
Differentiate between an inspector and a mutator ?
Using a smart pointer can we iterate through a container?
When does a name clash occur in c++?
What are the advantages of using typedef in a program?
What is a c++ class?
What does return 0 do in c++?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
How to tokenize a string in c++?
Why use of template is better than a base class?
Write a program to find the Factorial of a number