Compiles but seems like assignment isn't registering

This is about my blackjack game again. I'm trying to make it completely object oriented from what I've already had. So this is what I have.


1
2
MyCards.GetCard() = TheDeck.Hit();
DealerCards.GetCard() = TheDeck.Hit();


I think the problem may be here as I've never tried putting a function on the left side. I read in the tutorial the lvalue must be a variable, but the function returns a structure so...I don't know if thats the problem or not. I would think that would be a compiler error that's why I kind of doubt it.

So both functions return objects of the same class. GetCard() returns the first object in an array that hasn't been assigned yet and Hit() returns the first, second, third card etc. But when it comes to printing the information that should have been assigned it is exactly as was left by the constructor.

Any and all help is always appreciated. Thanks
Last edited on
I don't think that is going to work the way you expect.
Function returns are transitory - you either have to use them straightaway
or assign them to a variable for later use.

so DealerCards.GetCard() = TheDeck.Hit(); does actually work
but the final result is discarded.
Ahhh I see. Thank you. I'm typing on my Ps3 right so I'll add more later.
Topic archived. No new replies allowed.