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

F

fl

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()
{
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top