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
Should the this pointer can be used in the constructor?
What are the types of array in c++?
What is data abstraction? How is it different from data encapsulation?
What is the difference between passing by reference and passing a reference?
What is do..while loops structure?
Explain the term memory alignment?
Is vector a class in c++?
We use library functions in the program, in what form they are provided to the program?
the first character in the variable name must be an a) special symbol b) number c) alphabet
Explain 'this' pointer and what would happen if a pointer is deleted twice?
What is an undefined reference/unresolved external symbol error and how do I fix it?
What is #include math h in c++?
Which is better c++ or java?
How come you find out if a linked-list is a cycle or not?
Is there any difference between int [] a and int a [] in c++?