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

Abstract Class C#

Abstract classes in C# are used to declare common characteristics of subclasses without allowing objects to be created from the abstract class itself. Abstract classes can contain abstract methods that subclasses are required to implement, as well as non-abstract methods and properties. They allow code to be shared between subclasses without requiring the subclasses to implement all of the abstract class's functionality.
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)
191 views2 pages

Abstract Class C#

Abstract classes in C# are used to declare common characteristics of subclasses without allowing objects to be created from the abstract class itself. Abstract classes can contain abstract methods that subclasses are required to implement, as well as non-abstract methods and properties. They allow code to be shared between subclasses without requiring the subclasses to implement all of the abstract class's functionality.
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

ABSTRACT CLASS IN C#

The word abstract means a concept or an idea not associated with any specific
instance. In programming we apply the same meaning of abstraction by making
classes not associated with any specific instance.
The abstraction is done when we need to only inherit from a certain class, but not
need to instantiate objects of that class.
In C#, abstraction is achieved using Abstract classes and interfaces.

Abstract Class:
 C# Abstract classes are used to declare common characteristics of
subclasses.
 A class which contains the abstract keyword in its declaration is
known as abstract class.
 It can only be used as a BASE class for other classes that extend
the abstract class.
 Abstract classes may or may not contain abstract methods, i.e.,
methods without body ( public void get(); )
 Like any other class, an abstract class can contain fields that
describe the characteristics and methods that describe the actions
that a class can perform.
 But, if a class has at least one abstract method, then the class
must be declared abstract.
 If a class is declared abstract, it cannot be instantiated.
 To use an abstract class, you have to inherit it from another class,
provide implementations to the abstract methods in it.
 If you inherit an abstract class, you have to provide
implementations to all the abstract methods in it.
 An abstract class can implement code with non-Abstract methods.
 An Abstract class can have modifiers for methods, properties etc.
 An Abstract class can have constants and fields.
 An abstract class can implement a property.
 An abstract class can have constructors or destructors.
PERSON

STUDENT TEACHER

You might also like