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.
Abstract classes are purely conceptual rather than concrete. For instance, a shape is an abstract class whereas a circle is a concrete class; it is a specific type of shape. Thus we can derive circles, rectangles and triangles from a common abstract shape class.
Abstract classes are typically used to define common interfaces shared by all its derivatives where the concrete types provide the specific implementations for those interfaces. For instance, all types of shape can be drawn, but a shape cannot implement that interface without knowing what type of shape it is. A circle can. As can a rectangle or a triangle. Thus the draw method is a common abstract interface for all shapes. This then means that we can create a collection of shape objects and, without knowing their specific types, we can invoke their draw methods.
One key feature of an abstract class is that they cannot be instantiated other than through derivation. That is, only concrete classes can be instantiated. In order to become a concrete class, a derived class must fully implement the abstract interface inherited from its base class. However, concrete classes need not inherit an abstract interface. Any class that can be instantiated in its own right is regarded as a concrete class, whether it has an abstract interface or not.
Abstraction, Encapsulation & Inheritance are all Object Oriented concepts that are used in programming languages like Java extensively. Check out the links in the related links section to learn more about these concepts with examples.
Note: Explaining this concept in this answer would involve pages of text which could be too long to read in one go.
The best means subjectively to the readers. An abstraction is good only the readers can grasp what it means (seems every instance that the reader can think of fits to the description/abstraction), but cannot create one instance from it directly.
For example, Cat, is a good abstraction, Human Being, is another one.
Every instance (in your mind when you see those words) fit the abstraction, but you cannot use that term to create an instance.
I would argue that there are "Better Abstraction" only, there is no "best" (yet)
abstraction, inheritance, encapsulation, and polymorphism.
Encapsulation is one of the four pillars of object-oriented programming. The other three are inheritance, polymorphism and abstraction.
The four main pillars of all OOP languages are encapsulation, inheritance, polymorphism and abstraction.
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.
Encapsulation,Inheritance and Polimorphisim...
abstraction, inheritance, encapsulation, and polymorphism.
Encapsulation, inheritance, polymorphism and abstraction.
Data Encapsulation, Abstraction, Inheritance, Polymorphism
Inheritance Encapsulation Polymorphism Abstraction
if any system supports for abstraction,encapsulation,inheritance and polymorphism.
The features of object oriented programming are Abstraction, Encapsulation, Polymorphism & Inheritance
Encapsulation is one of the four pillars of object-oriented programming. The other three are inheritance, polymorphism and abstraction.
The four main pillars of all OOP languages are encapsulation, inheritance, polymorphism and abstraction.
features are: 1. Inheritance 2. Polymorphism 3. Data Encapsulation 4. Data Abstraction etc..
polymorphism,inheritance,encapsulation,objects,classes
features are: 1. Inheritance 2. Polymorphism 3. Data Encapsulation 4. Data Abstraction etc..
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.