What is the second parameter int for in a function declaration with enum

Discussion in 'C++' started by fl, Dec 2, 2011.

  1. fl

    fl Guest

    Hi,

    When I search enum usage, I find the following example below. I find
    that the definition:


    inline Card::Suit operator++( Card::Suit &rs, int )


    is interesting to me. What is the second parameter int for? Could you
    tell me? Thanks.


    ..................................
    // enumeration_declarations.cpp
    class Card
    {
    public:
    enum Suit
    {
    Diamonds,
    Hearts,
    Clubs,
    Spades
    };
    // Declare two constructors: a default constructor,
    // and a constructor that sets the cardinal and
    // suit value of the new card.
    Card();
    Card( int CardInit, Suit SuitInit );


    // Get and Set functions.
    int GetCardinal(); // Get cardinal value of card.
    int SetCardinal(); // Set cardinal value of card.
    Suit GetSuit(); // Get suit of card.
    void SetSuit(Suit new_suit); // Set suit of card.
    char *NameOf(); // Get string representation of
    card.
    private:
    Suit suit;
    int cardinalValue;



    };


    // Define a postfix increment operator for Suit.
    inline Card::Suit operator++( Card::Suit &rs, int )
    {
    return rs = (Card::Suit)(rs + 1);


    }


    int main()
    {
     
    fl, Dec 2, 2011
    #1
    1. Advertising

  2. Pavel Volkovskiy, Dec 2, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Schnoffos
    Replies:
    2
    Views:
    1,251
    Martien Verbruggen
    Jun 27, 2003
  2. Hal Styli
    Replies:
    14
    Views:
    1,709
    Old Wolf
    Jan 20, 2004
  3. Stuart Redmann
    Replies:
    5
    Views:
    527
    Stuart Redmann
    Dec 14, 2007
  4. Steve Hicks
    Replies:
    2
    Views:
    1,314
  5. Luca Forlizzi
    Replies:
    4
    Views:
    486
    Luca Forlizzi
    Nov 14, 2010
Loading...

Share This Page