Professional Documents
Culture Documents
I N T E R FA C E I N
C#
D E F I N I T I O N O F A N I N T E R FA C E
ABSTRACT
CLASSES VS
I N T E R FA C E S
An abstract class in C# is a class that cannot be
ABSTRACT instantiated and is meant to be inherited by
CLASS other classes. It can contain abstract members
that must be implemented by derived classes.
I N T E R FA C E
A class can inherit only one abstract A class can implement multiple
class. Multiple inheritance is not interfaces, providing flexibility and
allowed. allowing for the implementation of
multiple contracts.
M E T H O D I M P L E M E N TAT I O N
Abstract classes can have access modifiers. All interface members are
Use abstract classes when you want to Use interfaces when you want to define
provide a common base a contract for multiple unrelated
implementation and enforce derived classes to adhere to.
classes to implement specific behavior.
DEFINITION AND USAGE
DERIVED
I N T E R FA C E S I N
C#
DEFINITION OF
DERIVED
I N T E R FA C E
In C#, a derived interface is an interface that extends or
inherits from another interface. It can inherit the members
(methods, properties, events, or indexers) of the base
interface and can add its own members.
USAGE OF DERIVED INTERFACE