Reputation: 41
I am am new to programming and currently learning Pharo Smalltalk. However, I got to a part of the book I am using (LearningOOP) and I am stuck at "Adding a setter method". The exercise is to write the method count: such that when invoked on an instance of Counter, instance variable is set to the argument given to the message. Can anyone help please?
|c|
c := Counter new count: 7
c count 7
>>>7
Upvotes: 0
Views: 492
Reputation: 152
In Counter class (instance side):
count: anInteger
count := anInteger
Upvotes: 2