Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding operator overloading
Message
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Title:
Understanding operator overloading
Miscellaneous
Thread ID:
01064520
Message ID:
01064520
Views:
56
This is more a VFPer learning .Net instead of VFP and .Net.

I've started a C# class and I'm having some difficulty with operator overloading.

It's a card game (great real-world example, huh) with a Deck class and a Hand class. Both have card arrays that contain card objects. I'm trying to overload the + operator of the Hand class so that I can get a card from the deck array into the hand array. This is a requirement of the lab, not something I decided to do on my own.

Hand h1 = new Hand();
Deck d = new Deck();

//Should add a card object to h1.Cards array
h1+= d.DealCard();

Anybody? Anybody? Bueller?

Thanks,

E.R.
Regards,

E.R. Gilmore
Next
Reply
Map
View

Click here to load this message in the networking platform