Jun-07-2018, 02:20 AM
Something perhaps like...
class Smith: lastname = "Smith" def say_hello(self): print(f"Hi, I'm {self.firstname} {self.lastname}!") class John(Smith): firstname = "John" class Jane(Smith): firstname = "Jane" # not on the shirt but an example in action... John().say_hello() Jane().say_hello()
Output:Hi, I'm John Smith!
Hi, I'm Jane Smith!