ruby-uebungen/Assignment_008/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: Zugriffsmethoden































```ruby class Professor attr_reader :name attr_accessor :fach

def initialize(name, fach) @name = name @fach = fach end

def to_s "Prof. #{@name} lehrt #{fach}" end end

p = Professor.new('Smits', 'PR3') puts p.name puts p.fach p.fach = 'WIA' puts p.fach