ruby-uebungen/Assignment_036/solution
Thomas Smits fe2c1c6eb6 Update of exercises 2023-05-25 17:47:19 +02:00
..
readme.md Update of exercises 2023-05-25 17:47:19 +02:00

readme.md

Lösung: Eigenclass einer Klasse

















































































```ruby class Numeric class << self def to_binary(n) n.to_s(2) end end end

puts Numeric::to_binary(47)


Alternative Lösung:

```ruby
class << Numeric
  def to_binary(n)
    n.to_s(2)
  end
end

puts Numeric::to_binary(47)