- Create a new console application in Visual Studio and call it ClassesAndGenerics.
- Add an abstract class called Cat. To do this, add the abstract keyword to the class. We are now ready to describe the Cat abstract class:
public abstract class Cat { }
The abstract keyword indicates to us that the object it is applied to has no implementation. When used in a class declaration, it basically tells the compiler that the class is to be used as a base class. This means that no instance of the class can be created. The only way in which implementation of the abstract class happens is when it is implemented by derived classes that inherit from the base class.
- Your console application code should now look as follows:
class ...