Objective-C Lecture 3 - Bhecker.com

mewlingtincupΛογισμικό & κατασκευή λογ/κού

9 Νοε 2013 (πριν από 3 χρόνια και 5 μήνες)

60 εμφανίσεις

Introduction to

C Programming

(Level: Beginner)

Lecture 3

Derivation and Runtime binding

Derivation and runtime binding are the
most essential parts of Object Oriented



Derivation is the syntactic mechanism for

Inheritance is the semantic of derivation, it
expresses the meaning of derivation.

Derivation is a mechanism by which a class
acquires the methods and instance variables
of another class, called its superclass.

Inheritance in Objective

Initializers under inheritance

Inheritance is expressed in the new class’s interface declaration

@interface GradStudent : Student

{//additional instance variables

NSString* major;


// list inherited method to override

// list new methods of GradStudent for example a

// designated inititializer for GradStudent

(id)initGradStudent(NSString*)name :(float)gpa
:(NSString*) major;

Runtime binding

This is the decision during runtime which
method to execute when a message is sent to
an object. The executed message depends on
the type of the object.

The message can be sent through the typeless
pointer id.