I have some class SimpleButton. It is a Child of Button class. Button class has some method, which is overridden in SimpleButton. Now, if I whant to get access to this method from simpleButton, I just need to call [super someMethod]; But how to get access to it from outside of simpleButton? I tried:
SimpleButton *button;
[(Button*)button.superclass someMethod];
but this does not works…
You can’t do it like that. If you’ve overridden a method in a subclass then you have changed the publicly available method of that class to be the one in your implementation. You would have to have a separate method which just calls the super implementation:
Say you’ve overridden method
foo. Create a new method,superFooWhich internally does this:
However, if you need to do this sort of thing then you probably need to rethink why you have overridden the method in the first place. Perhaps you should have a new method on your subclass instead which does the unique parts and calls the super implementation itself, rather than overriding.