Advertisement
Dekita

Person Example

Aug 17th, 2014
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class Person
  2. def initialize
  3. @name = "Newborn"
  4. @age = 1
  5. end
  6. def name
  7. @name
  8. end
  9. def age
  10. @age
  11. end
  12. end
  13. class Dekita < Person
  14. def initialize
  15. @name = "Dekita"
  16. @age = 24
  17. end
  18. end
  19.  
  20.  
  21. class Dekita
  22. alias :init_alias :initialize
  23. def initialize
  24. init_alias
  25. @gender = "??"
  26. end
  27. def gender
  28. @gender
  29. end
  30. end
  31. dekita = Dekita.new
  32. p dekita.name
  33. p dekita.age
  34. p dekita.gender
  35.  
  36.  
  37. module Person_New
  38. def new_stuff
  39. return "New Stuff"
  40. end
  41. end
  42. class Person
  43. include Person_New
  44. end
  45.  
  46. p dekita.new_stuff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement