Passing in a pointer parameter to set it to another parameter

Lets say we have a class named Test. I want to pass in a pointer of type int so i can set the parameter equal to my variables in my class. It's basically

Why can't i set two pointers equal to each other inside a class.

1
2
3
4
5
void  Test::setTest(int* ptr_param)
{

*classVar = *ptr_param;
}
Last edited on
try this

1
2
3
4
5
void  Test::setTest(int* ptr_param)
{

 classVar = ptr_param;
}


if you can please show me the whole Test class
Last edited on
I figured it out i was confused with pointers at the time
Topic archived. No new replies allowed.