Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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.