I got a boolean variable in my controller class and I want to access that variable to check a condition in another helper class.
Ex: Class MainController {
public boolean showValue {get; set;} // globally declared
}
I created an instance of the MainController class in my helper class and tried accessing the boolean value but I get an error saying
"Variable does not exist"
, following is what I tried in the helperClass
Ex: Class HelperClassForController {
public MainController mcontroller {get; set;}
public static method1(){
if(mcontroller.showValue){ // I get the error here
// Some Code
}
return value;
}
}
How can I access the boolean variable ?