Class Card Deck


Joined
Jul 3, 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()
{

}
 
Ad

Advertisements


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

Top