class a
{
int x,y,func(template);
}
int a::func(template obj)
{
//do stuff
}
class b
{
int function(a)
}
int b::function(a obj)
{
a(this);
}
I am unable to pass "this" to the function, it tells me this every time I try to access something:
error: request for member `x' in `obj', which is of non-class type `player*'
x being the member, obj being the parameter name, and player being the class that is being passed.
How would do this?
c++ class as paramater from within the class
I tried a few times to put this into words, none of them made any sense. Basically, I am trying to call a function with a class parameter, the catch is the class being passed is the class I am calling it in. Here is a code example (I know the code doesn't work, this is a quick example)
By passing the correct parameter?
this is a pointer type. Your arguments (as you describe them) are not. Either dereference the pointer or make the method take a pointer.
this is a pointer type. Your arguments (as you describe them) are not. Either dereference the pointer or make the method take a pointer.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement