neurocomp2003
- 1,359
- 4
i have this following code with local var as a "ref. to ptr"
class node {
CType* data;
CTYpe* operator*() { return data; }
}
void F(node *a, node *b)
{
CType*& tp; tp=**a;
}
I get the error "Cannot convert CType* to CType*&
which i sort of understnad but i do not know how to resolve this.
The reason I'm looking to do this is so that i don't have (**a).Data() throughout my code but rather tp.Data(); and i need it to be a reference otherwise it would not change the variable outside of hte Fx.
I guess i can use a ptr to ptr(CType**) but i'd much rather just use a C++ reference. and if i do tp=***a i still get a error.
thanks in advance
class node {
CType* data;
CTYpe* operator*() { return data; }
}
void F(node *a, node *b)
{
CType*& tp; tp=**a;
}
I get the error "Cannot convert CType* to CType*&
which i sort of understnad but i do not know how to resolve this.
The reason I'm looking to do this is so that i don't have (**a).Data() throughout my code but rather tp.Data(); and i need it to be a reference otherwise it would not change the variable outside of hte Fx.
I guess i can use a ptr to ptr(CType**) but i'd much rather just use a C++ reference. and if i do tp=***a i still get a error.
thanks in advance