A question about outstream operator function

There's requirement on my assignment that says: The class needs a helper function to be called by outstream operator function. What does it mean by this? I have the following code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ostream & operator<<(ostream & out, Card aCard)
{
    switch (int rank = aCard.getRank())
    {
        case 14: out << "A"; break;
        case 10: out << "T";
        case 11: out << "J"; break;
        case 12: out << "Q"; break;
        case 13: out << "K"; break;
        default: out << rank;
    }
    
    switch (suits suit = aCard.getSuit())
    {
        case diamond: out << "D"; break;
        case spade:   out << "S"; break;
        case heart:   out << "H"; break;
        case club:    out << "C"; break;
    }
    return out;
}
Last edited on
Topic archived. No new replies allowed.