Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
What is Abstraction? | Polymorphism and Abstraction
In-Depth Python OOP

What is Abstraction?

Abstraction is one of the fundamental concepts of OOP in Python. From a human perspective, all classes in code are abstract (we can't touch them). However, machines can operate with them. Nevertheless, it is possible to create an abstraction even for machines, making the class abstract for them as well.

In Python, an abstract class is a class that cannot be instantiated directly and is meant to serve as a blueprint for other classes. It provides a common interface or set of methods that derived classes are expected to implement.

Let's consider the example:

The provided example demonstrates the creation of an abstract class called SomeClass, which serves as a blueprint for the derived class NewClass. An abstract class acts exclusively as a blueprint for its derived classes and cannot be directly instantiated.

In subsequent chapters, we will explore the ABC class, the @abstractmethod decorators, and delve into the structure and details of abstract classes.

Everything was clear?

Section 4. Chapter 4
course content

Course Content

In-Depth Python OOP

What is Abstraction?

Abstraction is one of the fundamental concepts of OOP in Python. From a human perspective, all classes in code are abstract (we can't touch them). However, machines can operate with them. Nevertheless, it is possible to create an abstraction even for machines, making the class abstract for them as well.

In Python, an abstract class is a class that cannot be instantiated directly and is meant to serve as a blueprint for other classes. It provides a common interface or set of methods that derived classes are expected to implement.

Let's consider the example:

The provided example demonstrates the creation of an abstract class called SomeClass, which serves as a blueprint for the derived class NewClass. An abstract class acts exclusively as a blueprint for its derived classes and cannot be directly instantiated.

In subsequent chapters, we will explore the ABC class, the @abstractmethod decorators, and delve into the structure and details of abstract classes.

Everything was clear?

Section 4. Chapter 4
some-alt