Question: Revise DerivedClassConstructionDemo to include a copy constructor for class A and class B . Once done, test your code with the following main program. It

Revise DerivedClassConstructionDemo to include a copy constructor for class A and class B. Once done, test your code with the following main program. It should work in assigning to a1 a replica of a and to b1 a replica b.
public class DerivedClassConstructionDemoMain {
public static void main(String[] args){
A a, a1;
B b, b1;
a = new A(1,2);
b = new B(1,2,3,4);
a1= new A(a);
b1= new B(b);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!