Question

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?

Was it helpful?

Solution 2

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.

OTHER TIPS

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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top