0% found this document useful (0 votes)
28 views2 pages

Abstract Class and Its Facts: Public Abstract Void Mymethod

An abstract class cannot be instantiated, but can contain abstract and virtual methods and properties. Derived non-abstract classes must implement all abstract members, while abstract methods have no body and are implicitly virtual. Abstract classes are often used to provide common functionality for a class hierarchy through non-abstract methods, while leaving some methods to be implemented by subclasses through overrides.

Uploaded by

ssumanmishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Abstract Class and Its Facts: Public Abstract Void Mymethod

An abstract class cannot be instantiated, but can contain abstract and virtual methods and properties. Derived non-abstract classes must implement all abstract members, while abstract methods have no body and are implicitly virtual. Abstract classes are often used to provide common functionality for a class hierarchy through non-abstract methods, while leaving some methods to be implemented by subclasses through overrides.

Uploaded by

ssumanmishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Abstract Class and its facts

1. can't create an instance/object of them - if you try, you will get a compile error.

2. An abstract class may contain abstract methods and accessors.

3. The sealed modifier prevents a class from being inherited and the abstract modifier requires a

class to be inherited.

4. A non-abstract class derived from an abstract class must include actual implementations of all
inherited abstract methods and accessors.

5. Use the abstract modifier in a method or property declaration to indicate that the method or

property does not contain implementation.

6. An abstract method is implicitly a virtual method.


7. Abstract method declarations are only permitted in abstract classes.
8. Because an abstract method declaration provides no actual implementation, there is no method
body; the method declaration simply ends with a semicolon and there are no curly braces ({ })
following the signature. For example:

public abstract void MyMethod();


9. The implementation is provided by an overriding methodoverride, which is a member of a non-
abstract class.

10. It is an error to use the static or virtual modifiers in an abstract method declaration.

11. Abstract properties behave like abstract methods, except for the differences in
declaration and invocation syntax.

 It is an error to use the abstract modifier on a static property.


 An abstract inherited property can be overridden in a derived class by including a
property declaration that uses the override modifier.
12. An abstract class must provide implementation for all interface members.

An abstract class that implements an interface might map the interface methods onto abstract
methods. For example:
interface I

{
void M();
}
abstract class C : I
{
public abstract void M();
}
13.

You might also like