I am beginner to core java. We know that multiple inheritance is not possible with classes, but my question is
In a business requirement there are two classes C1
and C2
already defined and given to us. Now C1 has method m1()
and C2
has method m2()
. Now my class is C3
. How to access the methods of m1
and m2
defined in classes C1
and C2
in my class C3
,
C3 c3=new C3();
c3.m1();
c3.m2();
By creating the instance of my class I should able to access the methods in the classes given to me
Note:: Code for the classes C1
and C2
should not be changed and I should not create the objects of C1
and C2
, by creating the object of C3
I should be able to access the methods.
Can any please help me for solving this?