class c = object method a = 2 method private b = 3 end (* let i = (new c)#b (* Invalide: #b privée. *) *) class d = object (self) inherit c method a = self#b end (* Encore plus privé? *) class c' : object method a : int end = object method a = 2 method private b = 3 end class d' = object (self) inherit c' (* method a = self#b (* Invalide: #b non définie. *) *) end class virtual e' = object (self) inherit c' method a = self#b method virtual private b : int end class f' = object inherit e' method private b = 4 end let () = Printf.printf "%d\n" (new f')#a