Question types

Start with

Question limit

of 10 available terms

Print test

10 Matching questions

  1. 6.Exception Handling
  2. 5.Methods and Selectors
  3. 10. id
  4. 4.Selectors
  5. 2.Fast Enumeration
  6. 9.Object Basics
  7. 8. Objects
  8. 7.The Runtime System
  9. 3.Enabling Static Behavior
  10. 1.Associative References
  1. a Methods and Selectors
    Varying the Message at Runtime
    The Target-Action Design Pattern
    Avoiding Messaging Errors
  2. b In Objective-C, object identifiers are of a distinct data type: id. This type is the general type for any kind of object regardless of class and can be used for instances of a class and for class objects themselves.
    id anObject;
    For the object-oriented constructs of Objective-C, such as method return values, id replaces int as the default data type. (For strictly C constructs, such as function return values, int remains the default type.)
    The keyword nil is defined as a null object, an id with a value of 0. id, nil, and the other basic types of Objective-C are defined in the header file objc/objc.h.
    id is defined as pointer to an object data structure:
    typedef struct objc_object {
    Class isa;
    } *id;
    Every object thus has an isa variable that tells it of what class it is an instance. Since the Class type is itself defined as a pointer:
    typedef struct objc_class *Class;
    the isa variable is frequently referred to as the "isa pointer."
  3. c As the name implies, object-oriented programs are built around objects. An object associates data with the particular operations that can use or affect that data. Objective-C provides a data type to identify an object variable without specifying a particular class of the object.
  4. d Enabling Exception-Handling
    Exception Handling
    Catching Different Types of Exception
    Throwing Exceptions
  5. e SEL and @selector
    Methods and Selectors
    Method Return and Parameter Types
  6. f Default Dynamic Behavior
    Static Typing
    Type Checking
    Return and Parameter Types
    Static Typing to an Inherited Class
  7. g The Syntax
    Adopting Fast Enumeration
    Using Fast Enumeration
  8. h An object associates data with the particular operations that can use or affect that data. In Objective-C, these operations are known as the object's methods; the data they affect are its instance variables (in other environments they may be referred to as ivars or member variables). In essence, an object bundles a data
    structure (instance variables) and a group of procedures (methods) into a self-contained programming unit.
    In Objective-C, an object's instance variables are internal to the object; generally, you get access to an object's state only through the object's methods (you can specify whether subclasses or other objects can access instance variables directly by using scope directives, see "The Scope of Instance Variables" (page 36)). For others to find out something about an object, there has to be a method to supply the information. For example, a rectangle would have methods that reveal its size and position.
    Moreover, an object sees only the methods that were designed for it; it can't mistakenly perform methods intended for other types of objects. Just as a C function protects its local variables, hiding them from the rest of the program, an object hides both its instance variables and its method implementations.
  9. i The Objective-C language defers as many decisions as it can from compile time and link time to runtime. Whenever possible, it dynamically performs operations such as creating objects and determining what method to invoke. Therefore, the language requires not just a compiler, but also a runtime system to execute the compiled code. The runtime system acts as a kind of operating system for the Objective-C language; it's what makes the language work. Typically, however, you don't need to interact with the runtime directly. To understand more about the functionality it offers, though, see Objective-C Runtime Programming Guide.
  10. j Creating Associations
    Retrieving Associated Objects
    Breaking Associations
    Complete Example