Let's say that I have the function
doSomething(char* (*getterOne)())
{
//do something here
}
although I've named the parameter of doSomething "getterOne", I have no way of verifying that the function is going to be a getter ( I think? ). So I wonder, is there a way to explicitly specify the kind of function that can be passed as an argument? For example, if I have the class "Cat", is there a way to say that the function doSomething accepts as parameter function, that belongs to the class Cat, and if so, how can I use it like this:
doSomething(char* (*getterOne)())
{
Cat cat;
cat.getterOne(); // where getterOne will be the getter that I pass as a parameter and do something with it
}
Also if anyone asks why I use char* instead of string, it is for a school project and we are not allowed to use string.