I am working on an assignment in C++ and am having difficulties with a question.
We are given a function that can take anything in as an argument.
We need to call this function, UberFunction, as an int, int*,
int**, and char[].
When I call:
UberFunction(42);
the assignment gives me points for a correct answer. Directly under this I have tried:
int* UberFunction(42);
int** UberFunction;
UberFunction(int*42);
...I have tried just about everything I can logically think of.
Am I missing something? If UberFunction(42)
is right for the int
part, why isn't UberFunction(int*42)
working?
My Code:
void CallUberFunctions() {
// There is a magic function, called "UberFunction" that is capable of taking
// anything for an argument. You need to call "UberFunction" with the
// following types: int, int* int** and char[]
// You also need to call "OtherUberFunction" in the namespace
// "uber_namespace" once, with no arguments.
UberFunction(42);
}
Here is the error:
home/user/Desktop/cpp_refresher/cpp_refresher.cc:22:20: error: expected '(' for function-style cast or type construction
Aucun commentaire:
Enregistrer un commentaire