0 votes
57 views
asked in C++ by
HI all

What is Dynamic and Static Typing language?
commented by
As in Ruby, Python, Smalltalk, Groovy… Extremely useful because we don’t always know beforehand what our objects are going to be at run-time. Dynamic typing in Objective-C is simple to use. For example, this declares a variable that can hold a reference to an object:
    id myObject;
Optional static typing
Still, Objective-C also has support for static typing. Best of both worlds.
This declares a variable that can hold a reference to an object of class (or subclass of) NSView:
    NSView *myObject;

1 Answer

0 votes
answered by (8.2k points)
Static typed languages
 
        are those in which type checking is done at compile-time, whereas dynamic typed languages are those in which type checking is done at run-time.
 
Dynamically-typed language
 
       meaning that you don't have to tell the compiler what type of object you're working with at compile time. Declaring a type for a varible is merely a promise which can be broken at runtime if the code leaves room for such a thing. You can declare your variables as type id, which is suitable for any Objective-C object.

Categories

...