Ruby Learning # 33 Inheritance

class Chef def make_chicken puts "The chef makes chicken" end def make_salad puts "The chef makes salad" end def make_special_dish puts "The chef makes bbq ribs" end end

class ItalianChef < Chef def make_special_dish puts "The chef makes eggplant parm" end def make_past puts "The chef makes pasta" end end

chef = Chef.new() chef.make_chicken

italian_chef = ItalianChef.new() italian_chef.make_pasta

Recommended Posts

Ruby Learning # 33 Inheritance
Ruby learning 4
Ruby learning 5
Ruby learning 3
Ruby learning 2
Ruby learning 6
Ruby learning 1
Ruby Learning # 25 Comments
Ruby Learning # 13 Arrays
Ruby Learning # 34 Modules
Ruby Learning # 14 Hashes
About Ruby inheritance
Ruby Learning # 15 Methods
Ruby Learning # 30 Initialize Method
Ruby Learning # 29 Classes & Objects
Ruby Learning # 20 Case Expressions
Ruby Learning # 24 Exponent Method
Ruby Learning # 17 If Statements
Ruby Learning # 21 While Loops
Ruby Learning # 31 Object Methods
Ruby Learning # 27 Writing Files
Ruby Learning # 35 Interactive Ruby (irb)
Ruby Learning # 9 Math & Numbers
Ruby inheritance and delegation
Ruby Learning # 28 Handling Errors
Ruby Learning # 26 Reading Files
Java learning memo (inheritance)
Ruby Learning # 23 For Loops
Ruby Learning # 16 Return Statement
Ruby Learning # 2 Drawing a Shape
Ruby on rails learning record -2020.10.03
JAVA learning history interface inheritance
Inheritance
Ruby on rails learning record -2020.10.04
Write class inheritance in Ruby
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
Inheritance
Ruby Learning # 18 If Statements (Con't)
Ruby Learning # 11 Building a Calculator
Ruby Learning # 99 Personal Programming Notebook
Ruby Learning # 10 Getting User Input
Ruby Learning # 32 Building a Quiz
Ruby Learning # 8 Working With String
Ruby on rails learning record-2020.10.07 ①
Ruby on rails learning record -2020.10.06
Ruby Learning # 19 Building a Better Calculator
Completed Progate Ruby Learning Course III
Learning Ruby with AtCoder 6 [Contest 168 Therefore]
Ruby Learning # 22 Building a Guessing Game
About object-oriented inheritance and about yield Ruby
Java learning (0)
[Ruby] Array
Ruby basics
About inheritance
Ruby basics
Ruby Review 2
Ruby addition
Refactoring Ruby
Learning Ruby with AtCoder 7 [Contest 168 Triple Dots]
Servlet learning