Wednesday, March 29, 2017

Tell about abstract class

Abstract classes are defined as classes using the modifier "abstract". When we want a class to be base class and we don't want to instantiate we use abstract classes. Many a times abstract classes are either partially implemented or not at all implemented.

An abstract class can contain either abstract methods or non abstract methods. Abstract members do not have any implementation in the abstract class, but the same has to be provided in its derived class.

An abstract class cannot be sealed class. We can have abstract methods only in abstract classes. We should use same access modifier for an abstract method in both base class and derived class to avoid compilation errors.

An abstract method cannot have virtual as it is implicitly virtual.

No comments:

Post a Comment

Call a function in child component from parent component in React

Consider the following parent component class Parent extends React.Component { constructor(props) { super(props);         thi...