Reputation: 24750
I'm getting this error:
Expected '(' for function-style cast or type construction
On the second line:
struct OpenALInterface * CreateOpenALInterface(int numLoadedSounds, int numPlayingSounds){
return new IOS_OpenAL(int numLoadedSounds, int numPlayingSounds); //ERROR ABOVE
// return new IOS_OpenAL(); //this works fine, no error
};
Class has this:
class IOS_OpenAL: public OpenALInterface{
public:
IOS_OpenAL(int numLoadedSounds, int numPlayingSounds){
//do stuff
};
// IOS_OpenAL(){}; //works
What exactly is this error referring to? It looks like a syntax error.
The base class is abstract with no constructors. Is that the issue? Can a subclass override or have its own constructor not in the base class?
Upvotes: 1
Views: 91
Reputation: 8292
Did you mean this:
struct OpenALInterface * CreateOpenALInterface(int numLoadedSounds, int numPlayingSounds){
return new IOS_OpenAL(numLoadedSounds, numPlayingSounds);
};
Upvotes: 3
Reputation: 3026
return new IOS_OpenAL(int numLoadedSounds, int numPlayingSounds);
should be
return new IOS_OpenAL(numLoadedSounds, numPlayingSounds);
The error happens because the compiler sees those "int" tokens and thinks you're trying to cast something to an int, but you're not.
Upvotes: 3