Multiple Events
-
Hello, I am writing a BlackJack type program to learn C++/.NET. I'm, trying to raise an event from Shoe Class (DealtCutCard Event) which is used by Dealer Class. Dealer sets a flag and at the apprpriate time raises a DealerShuffles Event which the Shoe Class uses. This code won't compile, the error is in the Shoe.h: "improper syntax for specifying event in __hook/__unhook" line 25 "improper syntax for specifying event in __hook/__unhook" line 25 "improper syntax for specifying event in __hook/__unhook" line 25 If I comment out #include "Dealer.h" and the __hook init function this will compile, but now I can only raise events from Shoe it won't recieve events from Dealer. How can I both call and handle events from between the same two classes? BTW - note i NEED "Shoe.h" in Dealer because there are functions in Dealer that reference Shoes. Using .NET 2003 Also, I tried substituting #include "Dealer.h" with class Dealer; as a predeclaration but that didn't work. Dealer.h
#pragma once
#include "Bettor.h"
#include "Hand.h"
#include "Shoe.h"#ifndef DEALER_H
define DEALER_H
[event_source(native)]
[event_receiver(native)]class Dealer
{
public:
__event void DealerShuffles(void);
Dealer(Shoe*);
void InitShoeEvents(Shoe* pSource){
__hook(&Shoe::DealtCutCard, pSource, &Dealer::ReadyToDeal);};
};
#endifShoe.h
#pragma once
#ifndef SHOE_H
define SHOE_H
#include "Dealer.h"
[event_receiver(native)]
[event_source(native)]
class Shoe
{
public:
void Shuffle(void);
//Initialize events from Dealer
void InitDealEvents(Dealer* pSource){
__hook(&Dealer::DealerShuffles, pSource, &Shoe::Shuffle);};
//Events
__event void DealtCutCard(void);
//Variables
};
#endif