Version française
Home     About     Download     Resources     Contact us    
Browse thread
Recursive class+type definitions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Raj B <rajb@r...>
Subject: Recursive class+type definitions
Hi all

Can we have mutually recursive definitions mixing types and classes?  
For example, I want to define
a class called mypoint, which contains another data structure (say, a  
custom list) of mypoints.

class virtual mypoint =
	object
		method virtual getx : float
		method virtual getlist : mypointlist
	end

type mypointlist = Empty | Cons of (mypoint * mypointlist)

What is the best way to achieve this kind of mutual recursion?

Thanks
Raj