What's the difference between an object and a class, as they look very similar

If i’m correct an object allows to have multiple different things having mutable state which is not shared. The only difference i see is that for a class you use the “new” “operator”.

The main differences between objects and classes is that you cannot inherit from objects, and that their type is not abbreviated. On the other hand, objects can appear anywhere inside expressions, as opposed to classes.

I suggest taking a look at the manual, which has a very nice explanations on this subject: OCaml - Objects in OCaml



A class is the blueprint for an object. You get an object out of a class by instantiating the class.
new creates an object from that blueprint.
Think of a class as a higher-order function if you’re more familiar with FP concepts.