This one is probably a basic oversight...
First, the code:
setIntLargestValue is just a local proxy. But this is one example of about 10 similar implementations of what I'm trying to do.Code://in format.cpp: void format::setIntLargestValue (int intInput){ intLargestValue = intInput; } int format::getIntLargestValue(){ return(intLargestValue); } void numberChecker(string strInput){ if (strInput.length() > format::getIntLargestValue()){ format.setIntLargestValue(strInput.length()); } }
When I compile I get "error: cannot call member function `int format::getIntLargestValue()' without object"
Now I understand what it's trying to tell me, but is there not a way to call the a function of this class without having to declare an object?
I'm trying to avoid writing this inside the class:
Any thoughts??Code:format clFormat; ... clFormat.setIntLargestValue(intInput); ...




Reply With Quote
