Difference between isa and super?


#1

Aren’t they both pointers to the class from which another object or class is derived?


#2

Let’s say that you have class Circle, which is a subclass of class Shape. When you create an instance of Circle, it has an instance variable called isa that points to its class structure, in this case, the class Circle. The class Circle has a pointer called superclass which points to its superclass’s class structure, in this case the class Shape.

super is not a pointer, it is a compiler directive. [super foo] says “run the method foo for me, but instead of starting the search at my class (which is pointed to by isa), start the search at its superclass.”


#3

Thanks, got it…just wondering; what does ISA stand for?


#4

ISA stands for … “Is a”

A car is a vehicle, thus inherits traits of vehicle (whatever they are.)