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 difference between class and structure in c++?
How to declare a function pointer?
what are function pointers?
how can i access a direct (absolute, not the offset) memory
address?
here is what i tried:
wrote a program that ask's for an address from the user,
creates a FAR pointer to that adress and shows it. then the
user can increment/decrement the value in that address by
pressing p(inc+) and m(dec-).
NOW, i compiled that program and opened it twice (in 2
different windows) and gave twice the same address to it.
now look what happen - if i change the value in
one "window" of the program, it DOES NOT change in the
other! even if they point to the same address in the memory!
here is the code snippet:
//------------------------------------------------------
#include What are advantages of c++? What does obj stand for? Why is main function important? What is operator overloading in c++ example? Is it possible for a member function to use delete this? Is c++ harder than java? Will the following program execute? What is the benefit of learning c++? List the special characteristics of constructor. What is the role of static keyword for a class member variable? What is a class template in c++?