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
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 |
Why isn't sizeof for a struct equal to the sum of sizeof of each member?
How many keywords are used in c++?
What is c++ map?
Write a program and call it sortcheck.cpp which receives 10 numbers from input and checks whether these numbers are in ascending order or not. You are not allowed to use arrays. You should not define more than three variables
What is a class definition?
Why is it difficult to store linked list in an array?
What is the difference between = and == in C?
20 Answers Christ University, Intel,
Is it possible to provide special behavior for one instance of a template but not for other instances?
Explain one-definition rule (odr).
What is protected inheritance?
write infinite loop in C++ which does not use any variable or constant?
Does c++ have finally?