I continue getting this same error:error C2228: left of '.Symbol' must have class/struct/union
Any Help into understanding this error will be greatly appreciated.
#include"stdafx.h"
#include"Deck.h"
#include"Card.h"
#include"DStack.h"
int main ()
{
Deck aDeck;
Deck *A = new Deck();
A->Generate(52);
Stack<Card> stk_d, stk_c, stk_t, stk_e;
Card *TempC = new Card();
char c,d,t,e;
int i;
int x=A->size();
c= 3;
d=4;
t=5;
e=6;
for(i=0; i<x; i++)
{
delete[] TempC;
TempC = new Card((*A)[i]);
if(TempC.Symbol==d)//ERROR HERE
{
stk_d.push(A->pop(i));
}//endif
else
{
if(TempC.Symbol=c)//ERROR HERE
{
stk_c.push(A->pop(i));
}
}//endelse
else
{
if(TempC.Symbol=t)//ERROR HERE
{
stk_t.push(A->pop(i));
}//endif
}//endelse
else
{
if(TempC.Symbol=e)//ERROR HERE
{
stk_e.push(A->pop(i));
}//endif
}//endelse
}//endfor
Last edited on
In the future, try to put your code in code tags. They show up as "<>" int the Format box.
Your problem is that TempC is a pointer (created with new). You need to use -> to access its members.