Problems with classes (super new)

Posted by user260036 on Stack Overflow See other posts from Stack Overflow or by user260036
Published on 2010-04-07T18:51:28Z Indexed on 2010/04/07 18:53 UTC
Read the original article Hit count: 300

Filed under:
|
|
|
|

Hi, I've problems to figure it out what's happening in the following exercise, I'm learning Smalltalk, so I'm newbie.

Class A>>new ^super new initialize.

A>>initialize a:=0.

Class B>>new: aParameter |instance| instance := super new. instance b: instance a + aParameter. ^instance

B>>initialize b:=0.

The problem says what happen when the following code is executed:

B new:10.

But I can't not figure it out why instance variable does not belong to A class.

Thanks

© Stack Overflow or respective owner

Related posts about smalltalk

Related posts about class