in Python by
Q:
How do you define abstract classes in Python?

1 Answer

0 votes
by

You define an abstract class by inheriting the ABC class from the abc module:

from abc import ABC

class AbstractCar(ABC):

    @abstractmethod

    def drive(self):

        pass

To implement the class, just inherit it:

class ToyotaSupra(AbstractCar):

    def drive(self):

        print('brrrr sutututu')

Click here to read more about Python
Click here to read more about Insurance

Related questions

0 votes
asked Aug 30, 2020 in Python by sharadyadav1986
0 votes
asked Jun 12, 2020 in Python by Robindeniel
0 votes
asked Dec 22, 2019 in Python by rajeshsharma
0 votes
asked Dec 19, 2019 in Python by sharadyadav1986
0 votes
asked Jan 16 in Python by SakshiSharma
...