__declspec(property()) and class declarator

405 Views Asked by At

So I've been trying to implement the same type of get and set like in C#. But something generated some doubts about how the variables are declared under the hood in c++. Here's the code:

class foo {
    foo Getter() {
        return *this;
    }
    foo f; //this isn't allowed
    __declspec(property(get = Getter)) foo f2; // but this IS
};

What's really happening here?

0

There are 0 best solutions below