In this example we will show how to add a property to the child class in Python.
Source Code
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def print_person_info(self):
print('name:', self.name, 'age:', self.age)
class Student(Person):
def __init__(self, name, age):
super().__init__(name, age)
self.grade = 'A'
s = Student('John', 15)
print(s.grade)
Output:
A