Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. As part of a military video game, a designer has created a vehicle class hier

ID: 3697484 • Letter: 1

Question

1. As part of a military video game, a designer has created a vehicle class hierarchy. The base class IS Vehicle, and it has AirVehicle, LandVehicle

and SeaVehicle as derived classes. The class SeaPlane inherits from both AirVehicle and SeaVehicle. Specifically, what design issues had to be considered in developing the SeaPlane class?

2, What is the distinction between an abstract base class and a virtual base class?

3. Give the output for the following program without executing the code.

Class A,{

protected:

int fa;

public:

A(int va = O) : fa(va) {

cout << "A constructor " << endl;

}

A(const A& va) : fa(va.fa) {

cout << "A copy constructor " << endl;

}

~A () {

cout << "A destructor" << endl;

}

A& operator=(const A& va) {

cout << "A = operator" << endl;

fa = va.fa;

return *this;

}

class B : public A {

protected:

int fb;

public:

B(int va = 0, int vb = 0) : fb(vb), A(va) {

cout << "B constructor " << endl; }

B(const B& vb) : fb(vb.fb), A(Vb) {

cout << "B copy constructor " << endl;

~B()   {

cout << "B destructor" << endl;

}

B& operator=(const B& vb) {

cout << "B = operator" << endl;

A::operator=(vb);

fb = vb.fb;

return *this;

};

int main() {

B    b1(1, 2);

B    b2;

b2 = b1;

B    b3(b1);

return 0;

}

Explanation / Answer

Multiple Questions : ANswering one (Question 3).

A constructor
B constructor
A constructor
B constructor
B = operator
A = operator
A copy constructor
B copy constructor
B destructor
A destructor
B destructor
A destructor
B destructor
A destructor