Property

2017-08-08  本文已影响0人  _AHINO

Property include getter and setter;

you can  get property like this:

Object.someProperty;

or

[Object someProperty];

Inheritance

overriding methods

when you override a method, you can only change its implementation.

Youcannot change how it is declared; the method's name ,return type , 

and argument types must stay the same;

Inheritance hierarchy

NSObject has many methods but only one instance variable: the isa pointer.

Every object's isa pointer points at the class that created it. (Get it ? When 

you have a BNRPerson instance , that object "is a" BNRPerson.

When you have an NSString instance, that object "is a [n]" NSString.)

The first implementation that is found is t


he one that gets executed..

description and %@

The token %@ use to get an object to describe itself .The %@ token sends a descroption

message to the object pointed to by the corresponding variable.

NSObeject has many methods but only one instance variable: the isa pointer.Every object's isa pointer points at the class that created it.(Get it ? When you have a BNRPerson instance , that object "is a" BNRPerson. When you have an NSString instance , that object "is a[n]" NSString.)

The descroption method returns a string that is a useful description of an instance of the class . It is an NSObject method,so evety object implements it.The default NSObject implementation returns the object's address in memory as string.

上一篇下一篇

猜你喜欢

热点阅读