SFML community forums

Help => General => Topic started by: Fierce_Dutch on December 02, 2010, 06:57:26 am

Title: Need help with This constuctor
Post by: Fierce_Dutch on December 02, 2010, 06:57:26 am
Here is my constructor and I am wondering why it is saying the arguments arent right.

in c++ file

xtra::Tile::Tile(const enum Tile::TileType type, int x, int y)

in .h file

Tile(const enum TileType type, int x, int y);

Help! btw it is a child of sf::Sprite if that matters
Title: Need help with This constuctor
Post by: Laurent on December 02, 2010, 08:08:50 am
Which line of code does the error refer to (is it when you use the constructor?)? What is the exact error message?
Title: Need help with This constuctor
Post by: Drektar on December 02, 2010, 03:40:19 pm
Do you really have a enum TileType inside your Tile class?
Code: [Select]

class Tile : public sf::Sprite
{
    public:
        enum TileType
        {
            Type1, Type2
        };

Someone know if he have a difference between
Code: [Select]
Tile(const enum TileType type, int x, int y);
//and
Tile(const TileType type, int x, int y);

It's just to remember this type is a enum?
Title: Need help with This constuctor
Post by: Laurent on December 02, 2010, 03:49:53 pm
Quote from: "Drektar"
Someone know if he have a difference between
Code: [Select]
Tile(const enum TileType type, int x, int y);
//and
Tile(const TileType type, int x, int y);

It's just to remember this type is a enum?

There's no difference, this is just a C-style declaration of a variable. In C++ we don't do that. It is similar to "struct Toto toto".