As a newbie to oop,and after reading all the tuts on polymorphism and casting, I am puzzled by how this works? code by mark incittis snake from
Gridwars 2(yeah I know everybody wants to do snakes ,including me!)
As there is no ref to arrays(which is how I would do it)
type nme6
field x,y,blah etc
field tail:nme6 ' object of type : Type var refering to same type??
field head:nme6
' this field var has a type declaration? type within type?
..then this...
function Create:nm6(x,y,length etc. )
'this function has a type???
..later there is this..
n.tail=nme6.create(.....)
(a field variable (within a type) = a value generated by a function(also within the same type)???
and finally this...
n.tail.head=n ????????? WTF!!is this advanced form of casting/polymorphism??
This is not covered in any tut Ive read
Can anyone explain this ?
end function
Gridwars 2(yeah I know everybody wants to do snakes ,including me!)
As there is no ref to arrays(which is how I would do it)
type nme6
field x,y,blah etc
field tail:nme6 ' object of type : Type var refering to same type??
field head:nme6
' this field var has a type declaration? type within type?
..then this...
function Create:nm6(x,y,length etc. )
'this function has a type???
..later there is this..
n.tail=nme6.create(.....)
(a field variable (within a type) = a value generated by a function(also within the same type)???
and finally this...
n.tail.head=n ????????? WTF!!is this advanced form of casting/polymorphism??
This is not covered in any tut Ive read
Can anyone explain this ?
end function