2023-05-25 17:47:19 +02:00
|
|
|
# Lösung: Geschachtelte Methoden
|
2023-05-23 09:19:31 +02:00
|
|
|
|
2023-05-25 17:49:42 +02:00
|
|
|
|
|
|
|
```ruby
|
2023-05-25 17:47:19 +02:00
|
|
|
class Bomb
|
|
|
|
def self.activate
|
|
|
|
def explode
|
|
|
|
puts "Booooommmmm"
|
|
|
|
end
|
2023-05-23 09:19:31 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-05-25 17:47:19 +02:00
|
|
|
b1 = Bomb.new
|
|
|
|
b2 = Bomb.new
|
|
|
|
b1.explode # Fehler
|
|
|
|
|
|
|
|
Bomb::activate
|
|
|
|
b1.explode
|
|
|
|
b2.explode
|
2023-05-23 09:19:31 +02:00
|
|
|
```
|