OCaml has structural typing for objects, and not named typing, as in Java. Thus, the type of an object is mainly determined (and determined only) by its methods. Objects in OCaml can be created directly without going through something like a class.
You can write functions that require that the objects of its argument have certain methods (and that these methods have certain types); for example, the following method takes an argument, which is any object with the bar method:
let foo x = x
newacct
source share