A
Avinash
I have a class defined as follows:
class main {
........
protected:
another_class *obj;
public:
void set_another_class(another_class *ptr);
}
main::set_another_class(another_class *ptr)
{
obj = ptr;
}
When I try to compile this, it gives me the following error:
"'obj' : undeclared identifier
'=' : cannot convert from 'class another_class *' to 'int'
Could somebody let me know why I cannot set a protected member from a
public method?
And also suggestion for setting the "another_class" pointer on "main".
class main {
........
protected:
another_class *obj;
public:
void set_another_class(another_class *ptr);
}
main::set_another_class(another_class *ptr)
{
obj = ptr;
}
When I try to compile this, it gives me the following error:
"'obj' : undeclared identifier
'=' : cannot convert from 'class another_class *' to 'int'
Could somebody let me know why I cannot set a protected member from a
public method?
And also suggestion for setting the "another_class" pointer on "main".