|Paste number 6236:||Eiffel generics (from book)|
|When:||15 years, 5 months ago|
|Share:||Tweet this! | http://paste.lisp.org/+4T8|
class STACK [G] feature count : INTEGER; ... put(x : G) is ... end -- class stack Using this class: sp : STACK [POINT]; creates a stack of points Eiffel also allows that: sp : STACK [ LIST [POINT]]; creates a stack of lists of point Eiffel also has constrained genericity: class VECTOR [G -> NUMBER] ... The generic type must be of type number (or descendant) now. [From "Object-Oriented Software Construction" Chapter 10, Chapter 16.4 respectively]
This paste has no annotations.