Paste number 6236: | Eiffel generics (from book) |
Pasted by: | tom_at_work |
When: | 20 years, 1 week ago |
Share: | Tweet this! | http://paste.lisp.org/+4T8 |
Channel: | #fpc |
Paste contents: |
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.