1. Use the abstract keyword in C# to declare classes and functions as abstract classes.
2. Abstract classes cannot be instantiated. Abstract functions have no execution code and must be rewritten in non-abstract classes.
3. Although abstract classes are also virtual, the virtual keyword does not apply, otherwise an error will be reported.
4. If a class contains abstract functions, the class will also be abstract and must be declared abstract.
5. In C++, abstract functions are described as pure virtual functions, but there is no such description in C#, and only the term abstract is used.
6. The abstract class can be defined as follows
view plaincopy to clipboardprint?
abstract class myAbstract
{
//The definition of variables does not apply to the abstract keyword
private int i;
//property
public abstract int Count { get; set; }
//method
public abstract string getName();
}
-