Inheritance vs. interface in C# [duplicate]

Class inheritance represents an “is-a” relationship, e.g., a Tank is a Vehicle. If your situation doesn’t at least meet this, choose interface over inheritance.

If the proposed base class doesn’t provide default implementations for your methods, this would be another reason to choose interface over inheritance.

In C#, you can only inherit from one class but multiple interfaces. This would be yet another reason to choose interface over inheritance.

Get the idea?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)