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 :)