Operator Overloading

BulldogLowell:
<<<< this is the assignment operator for type uint32_t

Understood, and that’s my conundrum. But, I can overload the [] operator to “sort of” do what I’m asking:

class myClass {
  private:
    uint32_t privateValue;

  public:
    myClass & operator=(uint32_t);
    uint32_t operator[](uint8_t);
};

myClass & myClass::operator=(uint32_t newValue) {
  privateValue = newValue;
  return *this;
}
uint32_t myClass::operator[](uint8_t) {
  return privateValue;
}

myClass myObject;

void setup() {
  uint32_t x;
  Serial.begin(115200);
  delay(1000);
  myObject = 100;
  x = myObject[0];
  Serial.println(x);
}

void loop() {}

But, this seems cheesy and ugly since it requires adding [index] to every access.

So, the only other choice is a getPrivateValue() method?

uint32_t myClass::getPrivateValue() {
  return privateValue;
}