Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Need help with This constuctor  (Read 1388 times)

0 Members and 1 Guest are viewing this topic.

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Need help with This constuctor
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Need help with This constuctor
« Reply #1 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?
Laurent Gomila - SFML developer

Drektar

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Need help with This constuctor
« Reply #2 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Need help with This constuctor
« Reply #3 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".
Laurent Gomila - SFML developer