caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Passing class type as parameter?
@ 2006-09-13 18:58 Jeremy Cowgar
  2006-09-14  0:00 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Cowgar @ 2006-09-13 18:58 UTC (permalink / raw)
  To: caml-list

Can I do something like:

class base_model = object(self)
   method from_array ary = ...
end ;;

class user = object(self)
   inherit base_model
   ...
end ;;

let finder sql class_type =
   query_database sql ;
   let res = new class_type in
     res#from_array res ;;

let users = finder "SELECT * FROM users" user in
   xxx yyy ;;

Ok. That is not working code, prob has syntax errors as well, but you  
get my idea. The problem I am having is passing the class to the  
generic finder method.

Thanks,

Jeremy


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-14  0:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-13 18:58 Passing class type as parameter? Jeremy Cowgar
2006-09-14  0:00 ` [Caml-list] " Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).