Passing in a pointer parameter to set it to another parameter

Sep 13, 2014 at 12:26am
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 Sep 13, 2014 at 12:26am
Sep 13, 2014 at 12:28am
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 Sep 13, 2014 at 12:29am
Sep 15, 2014 at 5:26am
I figured it out i was confused with pointers at the time
Topic archived. No new replies allowed.