The classic example: a stack
class Stack[T] {
push(item:T):void
pop():T
top():T
size():int
}
s:Stack[int] :=
new Stack[int];
s.push(3);
s.push(5);
print(s.pop());
Polymorphic
Message send:
“Ask the object to do something”
Method
Instantiation
Previous slide
Next slide
Back to first slide
View graphic version