The GO programming language has objects but no inheritance. It also has generics for the built-in types Array and Map. Is there a programming language with objects but no inheritance and with generics (i.e. parameterized types) for all user created types?

  • How do you define an object? Is a C-struct an object?
    – mouviciel
    Commented Aug 1, 2018 at 10:24
  • 1
    @mouviciel: An object is a value with a type, data fields and methods, and an identity that is distinct from all other objects of the same type. If C-structs have methods, they're probably objects.
    – Evan Aad
    Commented Aug 1, 2018 at 14:09

3 Answers 3


Rust has objects and general-purpose generics but not inheritance.

  • Thanks. Can you define a parameterized type in Rust?
    – Evan Aad
    Commented Jul 31, 2018 at 19:11
  • 2
    Yes. That's what general-purpose generics are. Commented Jul 31, 2018 at 19:25

I know JavaScript has objects and generics in the form of generic objects but it doesn't have inheritance if you're referring to the Java or C# way of inheritance since it really a prototypical language. But you can use JavaScript generic objects to achieve basically the generics you're looking for.

  • 1
    JavaScript doesn't have types, let alone generics. You are correct that JavaScript uses a prototype-based object system, but it still has a notion of inheritance via the prototype chain. Commented Dec 24, 2018 at 21:22
  • Sorry I just updated it to reflect how JavaScript does have a form of generics.
    – gdavis
    Commented Dec 24, 2018 at 21:40

Kotlin is a language too that allows for things like generics and objects as it was meant to interface and call Java code in kotlin but it doesn't support inheritance at all. You have to use interfaces which they can have concrete types but this is as close as one can get to inheritance with kotlin.

  • The first section in the introductory documentation for Kotlin about classes is "Classes and Inheritance" which illustrates classes deriving from other classes and overriding (non-abstract) methods. Commented Dec 24, 2018 at 19:30
  • Thank you for the information. Here is an update to my original comment: JavaScript is a language too that allows for things like generics and objects but doesn't have inheritance at all. The most one can do is use object cloning and one can reference and use another objects function(s) but there is no inheritance with JavaScript as it is with Java or C#.
    – user324226
    Commented Dec 24, 2018 at 19:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.