• godfilma@lemmy.blahaj.zoneOP
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    12 days ago

    I’m not an advanced reader yet, but I’m guessing that “deriving” is some other thing you can do with classes than making them a friend.

    • Voroxpete@sh.itjust.works
      link
      fedilink
      arrow-up
      5
      ·
      12 days ago

      Generally speaking, in object oriented programming there are ways to derive one class from another. So if you have a Car class, but you decide that it would actually make sense to have a Truck class as well, you can use Car as a starting point, inherit all of its properties, and then just change the specific parts that are different for the Truck class. This saves repeating work, and allows you to build in layers; instead of Car and Truck you might start with a Vehicle class, then derive a GroundVehicle class from that, then a Bike, Car and Truck class from GroundVehicle, and so on.