Class: Represent objects in code. Contain Fields (data storage), Methods (actions), Properties (attributes)
Interface: When an Interface is defined it lists out the public methods which must be created by any class which implements the Interface. It is a contract between objects stating that they will always provide their own implementations of a set of specific method signatures. This allows for other classes to accept an Interface type without knowing the details of its implementation, it only needs to know that the public contract methods are there for it to use.
Abstract Base Classes: When a class is declared as Abstract is prevents direct instantiation of the class in code. Instead a new class has to be created which derives from the Abstract class. This allows you to create a base class with base implementations but forces users of that class to derive their own classes from it in order to use the functionality.
Abstract Methods: When a base class declares a method as being Abstract it does not provide a default implementation and demands that all derived classes must override the method with its own implementation.
Virtual Methods: When a base class declares a method as being Virtual it provides a default implementation for that method but allows any derived classes to override the method with its own implementation.
Published by