# Objects use cases in OCaml

**URL:** <https://discuss.ocaml.org/t/objects-use-cases-in-ocaml/2282>\
**Category:** Learning\
**Tags:** oop, objects\
**Created:** [July 12, 2018, 9:27am UTC](https://discuss.ocaml.org/t/objects-use-cases-in-ocaml/2282 "2018-07-12T09:27:40Z")\
**Posts on this page:** 1\
**Showing post:** 28

<div class="post-metadata">

**Author:** ![echowuhao](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/echowuhao/32/83_2.png) [@echowuhao](https://discuss.ocaml.org/u/echowuhao)\
**Post date:** [June 10, 2019, 3:14am UTC](https://discuss.ocaml.org/t/objects-use-cases-in-ocaml/2282/28 "2019-06-10T03:14:49Z")

</div>

off topic for newbie question: for the student example.

```ocaml
module rec S1 : Student = Base(Younger(S1))
let s1 = S1.(say@@create 20);;
module rec S2 : Student = Base(Younger(S2))
let s2 = S2.(say@@create 20);;

```

1. how to interpret the ‘module rec’ for self?

the explain I can find is

> [@Module but no module type recursion?](https://discuss.ocaml.org/t/module-but-no-module-type-recursion/2374/3):
>
> I haven’t worked through your example, but one thing to note is that for modules which consist of only types, you can recursively define them to be themselves: module rec ... and S : sig type t = ... end = S This trick might provide a way to accomplish what you mean with and type ...

1. Is not the S1 and S2 the same?

---

_[View the full topic](https://discuss.ocaml.org/t/objects-use-cases-in-ocaml/2282)._
