Object Oriented Programming, Parent Class, Child Class
class vroom:
def __init__ (self, name, crash, global_warming):
self.name = name
self.crash = crash
self.global_warming = global_warming
class broom(vroom):
def __init__ (self, name, crash, global_warming, sweep):
super().__init__(name, crash, global_warming)
self.sweep = sweep
abc = broom(name = 'Raptor', crash = 'Yes', global_warming = 'Fake News lol', sweep = True)
print(
'name = ', abc.name,', ',
'crash = ', abc.crash,', '
'global_warming = ', abc.global_warming, ', ',
'sweep = ', abc.sweep
)
Very nice link to more exercises 🤓
class vroom:
def __init__ (self, name, crash, global_warming):
self.name = name
self.crash = crash
self.global_warming = global_warming
class broom(vroom):
def __init__ (self, name, crash, global_warming, sweep):
super().__init__(name, crash, global_warming)
self.sweep = sweep
abc = broom(name = 'Raptor', crash = 'Yes', global_warming = 'Fake News lol', sweep = True)
print(
'name = ', abc.name,', ',
'crash = ', abc.crash,', '
'global_warming = ', abc.global_warming, ', ',
'sweep = ', abc.sweep
)
Very nice link to more exercises 🤓