Skip to content

Instantly share code, notes, and snippets.

@okanyenigun
Last active March 6, 2022 17:46
Show Gist options
  • Save okanyenigun/7b7498d826094604cc42002ddd811bbb to your computer and use it in GitHub Desktop.
Save okanyenigun/7b7498d826094604cc42002ddd811bbb to your computer and use it in GitHub Desktop.
abstract_class_example
from abc import ABC, abstractmethod
class Vehicle(ABC):
@abstractmethod
def go(self):
pass
@abstractmethod
def stop(self):
pass
def open_doors(self):
print("Doors opened")
class Car(Vehicle):
#overriding abstract method
def go(self):
print("Gone")
#overriding abstract method
def stop(self):
print("Stopped")
Bmw = Car()
Bmw.open_doors()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment