objective c - Why subclass NSObject? -


What is the purpose / use of NSObject in Objective-C? I look at sections which extend the NSObject like this:

@interface fracture: NSObiquity

In C ++ or Java, we have NSObject We do not use any such variables, however, we have preprocessor instructions and import statements in both Object-C and Java

Why do classes get clearly from NSObject in Objective-C? What are the consequences of not declaring inheritance from NSObject?

We use NSObject to clearly state that I inherited from a given class C ++ Not sure about +, but there is something similar in Java - object class. The only difference is that Java does not require that the class clearly descend from the object - the language assumes anything in which a particular parent class does not decrease from the object. Objective-is different because it allows you to define different root sections - you are allowed to make those sections is allowed which does not inherit the NSBJX.

There is such a separate root class.

Take a look at this, it shows how the methods interact with the objective-c runtime through a function.

  + (id) allocWithZone: (NSZone *) z {return NSAllocateObject (auto, 0, z); } - (zero) DLOK {NSDAOloc object (self); } + (BOOL) is Shubasoff Class: (Class) Eccles {Return GSOBJCISIDOFF (Self, Eccles); }  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -