Skip to content

Instantly share code, notes, and snippets.

@Vasanth375
Created January 25, 2023 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vasanth375/ccd05cd7120ff04716f8387db57686a1 to your computer and use it in GitHub Desktop.
Save Vasanth375/ccd05cd7120ff04716f8387db57686a1 to your computer and use it in GitHub Desktop.
class Student(Person):
def __init__(self, name, age, major):
super().__init__(name, age)
self.major = major
def greet(self):
return super().greet() + " My major is " + self.major + "."
s1 = Student("Jane", 25, "Computer Science")
print(s1.greet()) # Output: "Hello, my name is Jane and I am 25 years old. My major is Computer Science."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment