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
Very very short question on objects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-10-26 (06:44)
From: William Chesters <williamc@d...>
Subject: Very very short question on objects
Christian RINDERKNECHT writes:
 > Method [f] is not private... Shouldn't be this an error?

It's deliberate: from node3.html#ss:private-methods in the html docs:

    Private methods can be made public in a subclass.  [...]  One
    could think that a private method should remain private in a
    subclass.  However, it since the method is visible in a subclass,
    it is always possible pick it's code and define a method of the
    same name that run that code, [...]

In other words, ocaml's `private' is more like Java's `protected', and
afair Java's behaviour here agrees with ocaml's.