Skip to content

Latest commit

 

History

History
30 lines (11 loc) · 855 Bytes

Abstraction.md

File metadata and controls

30 lines (11 loc) · 855 Bytes

Abstraction

a

Abstraction is the process of simplifying complex systems by focusing on essential features while ignoring irrelevant details. In OOP, abstraction is achieved through classes and interfaces. A class is a blueprint for creating objects, while an interface defines a set of methods that a class must implement.

Here's an example of a class in Python:

class Animal:

def __init__(self, name, species):

    self.name = name

    self.species = species



def speak(self):

    pass

In this example, we define a class called Animal. The init method is a constructor that initializes the object's name and species attributes. The speak method is empty, representing a common behavior of all animals.