You have the following program:
//Combined.cpp
class A {
int i;
public:
A(int ii) : i(ii) {}
~A() {}
void f() const {}
};
class B {
int i;
public:
B(int ii) : i(ii) {}
~B() {}
void f() const {}
};
class C : public B {
A a;
public:
C(int ii) : B(ii), a(ii) {}
~C() {} // Calls ~A() and ~B()
void f() const { // Redefinition
a.f();
B::f();
}
};
int main() {
C c(47);
} ///:~
1. Modify Combined.cpp to add another level of inheritance and a new member object. Add code to show when the constructors and destructors are being called.
2. In Combined.cpp, create a class D that inherits from B and has a member object of class C. Add code to show when the constructors and destructors are being called.
C++??!! experts in C++ help me fast I don't have time :1 day?
No kidding. Your solution is here
http://www.mindview.net/Books/TICPP/Solu...
It costs $12 though. But your teacher might probably use the question from this book again later. So, I guess it's worth to buy.
Your qutestion is here
http://web.mit.edu/merolish/ticpp/Chapte...
Reply:You can find many live C++ expert at websites like http://getafreelnacer.com/
Reply:with the same concept i can give u in java ... do u need them !!!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment