Order of Args in Class Cons.

Started by
0 comments, last by MaulingMonkey 15 years, 10 months ago
Does the order of the arguments in class constructors (or any function) matter? I have a class that accepts: (SDL_Surface*, SDL_Rect, int, bool), but it only compiled when I switched the int and the bool around: (SDL_Surface, SDL_Rect, bool, int). What's the deal?
Advertisement
SDL_Surface != SDL_Surface*.

The order of arguments definitely does matter, and what you've told us so far doesn't make sense.

I have the feeling your compiler was complaining about something like the destructor being declared one way and defined another. This won't work, for example:

struct foo { // <-- class definition    foo( int, char ); // <-- function/constructor declaration};foo::foo( char, int ) { // <-- function/constructor definition}


Since there is no function declaration corresponding to ( char, int ), only ( int, char ). The easiest way to figure out what exactly the problem you're encountering is, would be to post the relevant code that you expected to work that didn't -- so, the class definition, the constructor definition, and the line you're using to try and create an instance of your class with, presumably.

This topic is closed to new replies.

Advertisement