KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In Ocaml I'm struggling with subclassing and types: class super = object (self) method doIt = ... end; class sub = object (self) inherit super method doIt = ... self#somethingElse ... method somethingElse = ... end; let myFunction (s:super) = ... myFunction new sub Apparently in Ocaml, class sub is not a "subtype" of class super , because the sub#doIt method calls a method in sub that is not present in super . However, this seems like a pretty common use-case for OO programming. What is the recommended way to accomplish this?
Tags (comma-separated)
Save Edits
Cancel