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 |
Is turbo c++ free?
Is overriding possible in c++?
What are the rules for naming an identifier?
What is the main purpose of c++?
Why we use #include iostream in c++?
What is a modifier in c++?
Why preincrement operator is faster than postincrement?
Is swift faster than go?
What is binary search in c++?
What is pure virtual function? Or what is abstract class?
How does java differ from c and c++?
Can I learn c++ in a week?