Let's say I have an Objective-C class that's intended to be a singleton — its init method checks if there's already an instance of that class and returns it.
Now suppose you have two subclasses of this class, A and B, and that you do:
[[A alloc] init];
[[B alloc] init];
Now, when B's init calls super init, the latter returns an A. What happens when B's init tries to set ivars of B, which don't exist because self is actually an A? Will it corrupt memory, assign an int to an object pointer, etc?
What happens when a message is sent to the object that's defined only in B? I'm assuming you will get a runtime error saying that the selector doesn't exist. Correct?