class fill
{
image getColor(); //image is defined in another class
}
and I have its definition in a .cpp file
1 2 3 4
image fill::getColor()
{
return Color; //Color is defined in the other function of this class
}
Now when I call this function in my main, I get this error
getColor() is not a member of fill
But it is a member of fill, it's declared as public and it's syntax is correct as far as I can tell. I spelled everything right, I can't figure out what's wrong.
I have included the header file in the main cpp. There are 2 functions in my fill class, and it will let me call the other one, but not this one.
There may also be a scope issue here, your comment says "Color is defined in the other function of this class" but I do not see a variable named "Color" declared in your class. You cannot return something that does not exist. Also your class is missing a ';'.
LOL! Lots of confusion here. Your original post says that your main() calls for getColor(), yet the piece you show does no such thing. Also, you call Filler->getAverageColor(), but there is no such function in your class definition: You have getColor(), or getAverage(), but no getAverageColor().
I just want to add that right now your function "void getAverage()" does absolutly nothing. I am assuming from the 'get' part of the function name that you would like to use this to retrieve data but a void function with no arguments cannot return a value.
I'm trying not to use my actual code cause i'm not sure if i'm allowed to post it, but I don't know any other way to get help. getAverageColor() is what I mean when I say getAverage(). Sorry.
The void function isn't supposed to return anything, it's just supposed to fill up an image object, which is the private variable Color, then i'm getting that variable using the getAverage() function
I have my act completely together thank you, this is going to work if I could figure out why this won't recognize my function definition, i've never seen this error before, and I know very well how to use classes, I was just hoping someone else had had this happen to them. I'll take it somewhere else