robertvari

animalClass

Jun 11th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. class Animal:
  2.     def __init__(self, name, age):
  3.         self.name = name
  4.         self.age = age
  5.  
  6.         print ("uj animal class letrehozva")
  7.  
  8.     def say_name(self):
  9.         print(self.name)
  10.  
  11.     def say_age(self):
  12.         print(self.age)
  13.  
  14. class Dog(Animal):
  15.     def __init__(self, name):
  16.         self.name = name
  17.         print("uj kutya letrehozva")
  18.  
  19. buksi = Dog("Buksi")
  20. buksi.say_name()
Advertisement
Add Comment
Please, Sign In to add comment