So I'm new to this site, not really sure what the conventions are for how to go about asking a question, but I'm just beginning with Objective-C and have a question relating to the instantiating of objects.
Okay, so I know that the root class NSObject has the class methods alloc and init, and these methods are passed down to any classes that inherit NSObject, which is pretty much every class. I know the typical format for instantiating an object is like this:
MyObject *m = [[MyObject alloc]init];
But considering MyObject has the alloc and init methods inherited from NSObject, this could also theoretically work, considering that MyObject and NSObject have the same alloc and init methods (assuming that the class doesn't override them):
MyObject *m = [[NSObject alloc] init];
And it works for just instantiating, but when I try to call any method in the MyObject class, an NSException is thrown. When I switch the NSObject alloc back to MyObject alloc, it works. I just don't understand why! This is probably a basic question, but any explanation?
Thanks in advance!