• Blackmist@feddit.uk
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    I honestly don’t know why they even have -> instead of just a dot like everyone else. The compiler knows whether it’s a record, object, pointer, or any level of pointer to pointers.

    Why make the programmer do the donkey work?

    • gencha@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Operator overloading allows you to redefine what each operator does. It’s essential to achieve a truly fucked up code base

    • Morphit @feddit.uk
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      It’s important for objects that can be dereferenced. Smart pointers have methods that can be accessed with dot syntax like swap(). You can still dereference through a smart pointer using arrow syntax to access methods on the referenced type since they overload the operator->() method.