Tuesday, February 17, 2015

Why Multiple Inheritance is supported using Interface


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 Abstract Class as a Parent class for big projects where most of functionality is common in all the Child  classes. 

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

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...