English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
virtual instance variables
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-18 (18:50)
From: micha <micha-1@f...>
Subject: virtual instance variables

entering in the toplevel: 

class virtual c = object val virtual d : int end;;

then:

class d = object inherit c val d = 9 end;;

gives me: Exception: Not_found.
What is not found?  (compiling works)

if I define:
 class virtual c = object val d = 0 end;;
 class d = object inherit c val d = 9 end;;

gives the warning:
Warning V: the instance variable d is overriden.
The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)

I thought that  without the virtual declaration the behaviour is the
same as before?

cheers,
 Michael