Hi all,
I'm trying to use class variables as default parameters in my C++ code but get the following error:
var_A : use of member as default parameter requires static member
To illustrate my problem here is an example class:
class exampleClass {
private:
int var_A;
public:
int exampleMethod ( int varMethod = var_A )
{
.
.
.
}
};
Can I still do this and avoid declaring the var_A variable as 'static'.
Thanks in advance for all the replies.
I'm trying to use class variables as default parameters in my C++ code but get the following error:
var_A : use of member as default parameter requires static member
To illustrate my problem here is an example class:
class exampleClass {
private:
int var_A;
public:
int exampleMethod ( int varMethod = var_A )
{
.
.
.
}
};
Can I still do this and avoid declaring the var_A variable as 'static'.
Thanks in advance for all the replies.