Abstract class and class member, abstract class member
1. You cannot create an instance of an abstract class.
2. abstract classes are mainly used as base classes, but they can also inherit other common classes or abstract classes.
3. Abstract members can contain abstract members and ordinary implementation members.
4. Any class derived from an abstract class must use the override keyword to implement all abstract members of the class, unless the derived class itself is also an abstract class.
5. Abstract members can only be declared in abstract classes.
6. Abstract members include methods, attributes, events, and indexes.
Namespace example act_example {class Program {static void Main (string [] args) {MyClass m = new MyClass (); m. propertyValue = 100; m. output (); m. doWork (m. propertyValue); Console. readKey ();} public abstract class A {public abstract void DoWork (int I); // abstract members can only declare public abstract int PropertyValue {get; set ;} public void Output () // abstract class can contain common implementation member {Console. writeLine ("I am Abstract Class A") ;}} public class MyClass: A {int MyValue; public override void DoWork (int I) // The derived class must all implement all abstract members in the base class {Console. writeLine ("I am Class MyClass. my Value is {0} ", I) ;}public override int PropertyValue {get {return MyValue ;}set {MyValue = value ;}}}}}