answersLogoWhite

0

Abstract classes are a conceptual means of classifying objects. For instance, humans, gorillas, zebras, cats and dogs are all different types of animal but the one thing they all have in common is that they all have mammaries. Thus they are all classified as being mammals in the animal kingdom. The terms "animal" and "mammal" are entirely conceptual, thus they are abstractions. By the same token, circles, squares and triangles are all types of shape, where "shape" is the abstraction.

In computer programming, we use abstract classes to classify objects. Thus if our program utilised collections of shapes, we'd define an abstract class named shape and derive our specific types of shape from that class.

An abstract class is also known as an abstract data type or ADT. Ideally, an ADT has no data associated with it. The main function of an ADT is to provide a common interface to all its derivatives, typically though a pure-virtual interface. A pure-virtual method is a method that is common to all derivatives but one that must be implemented by those derivatives. For instance, if we wish to rotate all of our shapes, we can declare a pure-virtual rotate() method in the ADT shape class. Each derived class must then implement that method otherwise it, too, becomes an ADT.

In order for an instance of an ADT to exist, a derived class must implement all the pure-virtual methods inherited from its ADT. In so doing, we are assured that if an ADT exists, we can invoke any of its pure-virtual methods even if we do not know the specific type of the ADT. The specifics are handled by the derivative itself. Thus if we invoke the shape::rotate() method upon a square, the square::rotate() method will be invoked automatically. Thus we get the correct behaviour, automatically, without having to perform a runtime check to determine what type of shape is actually being rotated.

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

3 pillars of object oriented programming?

abstraction, inheritance, encapsulation, and polymorphism.


What are the benefits and application of OOP?

Encapsulation, inheritance, polymorphism and abstraction.


What are the characteristics of OOPS?

Data Encapsulation, Abstraction, Inheritance, Polymorphism


What are the basic concept of object oriented programming language?

Inheritance Encapsulation Polymorphism Abstraction


What is oops.explain briefly the elements of oops?

if any system supports for abstraction,encapsulation,inheritance and polymorphism.


What are the features of object oriented program?

The features of object oriented programming are Abstraction, Encapsulation, Polymorphism & Inheritance


Is encapsulation a characteristic of procedural or object oriented programming?

Encapsulation is one of the four pillars of object-oriented programming. The other three are inheritance, polymorphism and abstraction.


Basic concepts of OOP?

The four main pillars of all OOP languages are encapsulation, inheritance, polymorphism and abstraction.


What are basic features?

features are: 1. Inheritance 2. Polymorphism 3. Data Encapsulation 4. Data Abstraction etc..


Examples for oops concepts?

polymorphism,inheritance,encapsulation,objects,classes


What are basic java features?

features are: 1. Inheritance 2. Polymorphism 3. Data Encapsulation 4. Data Abstraction etc..


What is abstraction method in java?

Abstraction in Java or Object oriented programming is a way to segregate implementation from interface and one of the five fundamentals along with Encapsulation, Inheritance, Polymorphism, Class and Object. Abstraction in Java is achieved by using interface and abstract class in Java.