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
In int main(int argc, char *argv[]) what is argv[0] a) The first argument passed into the program b) The program name c) You can't define main like that
Is c++ still in demand?
How do you establish a has-a relationship?
Is c++ fully object oriented?
List the features of oops in c++?
What is the error in the code below and how should it be corrected?
What programming language should I learn first?
What is &x in c++?
What do you mean by friend class & friend function in c++?
What are proxy objects in c++?
Is it possible to have a recursive inline function in c++?
Give an example of run-time polymorphism/virtual functions.
If dog is a friend of boy and boy is a friend of house, is dog a friend of house?
What is difference between malloc()/free() and new/delete?
What are the comments in c++?