They differ when being inherited:
class
cm1
=
object
inherit
c1
method
m
= ()
end
class
cm2
=
object
inherit
c2
method
m
= ()
end
;;
The method
c
of class
cm2
returns an object of type
c2
instead of
cm2
, as checked below:
((
new
cm1
)#
c
:
cm1
);;
((
new
cm2
)#
c
:
cm2
);;
Also, while the types
c1
and
c2
are equal, the type
cm1
is only a subtype of
cm2
.