Class Card Deck

Joined
Jul 2, 2020
Messages
1
Reaction score
0
I'm trying to represent a deck of cards as a class, but when I try to use this it says "this may only be used in a nonstatic member function. I'm new to coding, so this is probably an easy fix.

Here's my code so far:

#include <iostream>
#include<string>
#include <random>
using namespace std;
class carddeck {
public:
string suit;
int number;
bool facecard;
}
carddeck(string suit, int number, bool facecard) {
this->suit = suit;
this->number = number;
this->facecard = facecard;
}

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
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top