Skip to main content
GameDev.net gamedev.net
🔒 Locked

Card game

Started by The Imp Aug 3, 2005 at 11:18 AM 1 replies 800+ views
Original Post
The Imp
The Imp
So, I'm making a simple card game and I have a problem with a class I've made for the cards:

class Card
{
public:
	Card(int Value, int Suit, char Name[50]);
	~Card();
private:
	int itsValue;
	int itsSuit;
	char itsName[50];
};

Card::Card(int Value, int Suit, char Name[50])
{
	itsValue = Value;
	itsSuit = Suit;
	itsName = Name;
}

Card::~Card()
{
}

When I compile it I get: error C2440: '=' : cannot convert from 'char[]' to 'char [50]' Does anyone know how to fix this?
guyaton
guyaton
itsName = Name;

Thats the line that is giving you problems right? Try this instead.

memcpy( itsName, Name, 50 );
~guyaton
The Imp
The Imp
Yes, that worked. Thanks a lot :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.