Platinum Partner

C++ Pointers Suck

// pointers worky


#include 

class A {
    public:
        void setMember(A& m) { this->member = &m; }

        A* member;
        int x;
};

int main(int argc, char** argv) {
    A a, b;
    a.x = 2;
    b.x = 3;
    a.setMember(b);
    b.setMember(a);
    
    std::cout << "a.member->x = " << a.member->x << "\n";
    std::cout << "b.member->x = " << b.member->x << "\n";
}
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}