I am trying to use the class member as the default parameter in one of the class methods of the same class.
Sample Code:
class A{
public:
struct asp *N;
// some other members..
void my_method(int arg1, struct asp *arg2=this->N){
// Definition
}
};
When I try to compile the code, I get the following error:
asp.cpp:19:50: error: ‘this’ may not be used in this context
I have tried both with and without this
keyword, without any success. Is there any restrictions to the usage of the data members within the class?