1

I have a class A which B inherits from. The inheritance includes a bunch of parameters, and they should all be initialized to some default values in both cases (whether we create an A object or a B object). I decided to put the initialization into the constructor of A, since the creation of B should create an A first. However, this doesn't seem to be happening automatically, and I was unable to figure out how to call the super constructor manually. Can some one help me out?

EpsilonVector
  • 3,973
  • 7
  • 38
  • 62

2 Answers2

3

You already found the solution, but here are some more notes that might help you to understand your question better:

  • super is similar to self, they both represent the receiver of the message.
  • self starts the lookup of the following message in the receiver of the message.
  • super starts the lookup of the following message in the superclass where the implementing method is defined in.
  • self and super are not messages but implicit variables, therefor you cannot find them in the message finder.
Lukas Renggli
  • 8,754
  • 23
  • 46
0

OK never mind... You use the word super. I guess that explains why there's no list of classes that define it in the method finder.

EpsilonVector
  • 3,973
  • 7
  • 38
  • 62