Monday, 5 August 2013

how to declare an object in Objective C language ?

There are two ways :

Myclass *obj1 ;  // strong type 

id obj1; // weak type - more flexible in use

Objective-C supports both strong and weak typing for variables containing objects. Strongly typed variables include the class name in the variable type declaration. Weakly typed variables use the type id for the object instead. Weakly typed variables are used frequently for things such as collection classes, where the exact type of the objects in a collection may be unknown. If you are used to using strongly typed languages, you might think that the use of weakly typed variables would cause problems, but they actually provide tremendous flexibility and allow for much greater dynamism in Objective-C programs.


1 comment:

  1. Casino and Sports Betting | Mohegan Sun at Pocono Downs
    Welcome to The Casino and Sports 경상북도 출장샵 Betting 김해 출장안마 Hub! We have over 2,300 available 서산 출장안마 games from the 통영 출장안마 top software providers! 경상남도 출장마사지

    ReplyDelete