Using Class: It gives me error as shown below.
A Class cannot have multiple Base Classes
We can see in the above example, When i am inherting two classes to Class C, It gives me an error.
Using Interface:
Output:
Example 2:
,
Conclusion:
Use an interface where, in every Child class, you want to define all the methods of the interface.
No comments:
Post a Comment
Thank you for visiting my blog