How would I do this

class test {
    public:
        int* num;
    };

int main() {
    test *d = new test;
    d->num = new int;
    d->*num = 3;
cout << d->*num;
}

Try something like this

#include <iostream>

class test {
    public:
        int* num;
    };

int main() {
    test *d = new test;
    d->num = new int;
    *(d->num) = 3;
  std::cout << *(d->num);
}
commented: thanks +1
#include <iostream>

class test {
    public:
        int* num;
    };
 
int main() {
    test *d = new test;
    d->num = new int;
    *d->num = 3;
    std::cout << *d->num;
}

Edit: Beaten to the punch by seconds!

commented: thanks anyway! +1

Yes, I feel so stupid. I could have figured it out myself :(
Thanks for help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.