Class Card Deck

Discussion in 'C Programming' started by honzie42, Jul 3, 2020.

  1. honzie42


    Jul 3, 2020
    Likes Received:
    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 <random>
    using namespace std;
    class carddeck {
    string suit;
    int number;
    bool facecard;
    carddeck(string suit, int number, bool facecard) {
    this->suit = suit;
    this->number = number;
    this->facecard = facecard;

    int main()

    honzie42, Jul 3, 2020
    1. 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 (here). After that, you can post your question and our members will help you out.