• sudo42@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    6 months ago

    QQ: What’s the difference between a “class-based language” and an “object -based language”?

    • grue@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      6 months ago

      In a class-based language, you declare the specification for a class and then (separately) instantiate members of it. You can also do inheritance and such.

      In an object-based language, you instantiate an object by explicitly declaring and setting the values of all the properties inside and then its type is defined to be itself. You can then make more objects of the same type by instantiating them and passing in the first object as the prototype to use.