basic question about building classes

I am new to C++ and I have a question about building your own class. I want to build a class called "Card" that consists of two components: a char variable that represents the suit of a card and a string variable that represents the number of the card. My question is: Can you put a restriction on the types of characters or strings that appear? For example, I don't want the suit variable to be just any character, I want it to be one of the characters in the set {'c', 'd', 'h','s'}. So when I declare the variable "char suit;" I want to restrict the kind of character that can show up. Is there an easy way to do this? Thanks!
You can declare a const character array that will contain acceptable characters.
Last edited on
Thanks for the help. I'm new to C++, so I don't know what that code would look like. Would you mind showing me the code? Thanks!
const char suit[] = "cdhs";
Topic archived. No new replies allowed.