.net delegāti
Kāpēc visi raksta tā
class HaHa
{
delegate void GlugGlug();
public:
void Zomg()
{
dispatcher->Invoke(DispatcherPriority::Normal, gcnew GlugGlug(this, &HaHa::Pooper));
dispatcher->Invoke(DispatcherPriority::Normal, gcnew GlugGlug(this, &HaHa::Pirate));
}
void Pooper() { }
void Pirate() { }
}
nevis šitā
class HaHa
{
delegate void GlugGlug();
GlugGlug^ glug;
GlugGlug^ zomg;
public:
HaHa()
{
glug = gcnew GlugGlug(this, &HaHa::Pooper);
zomg = gcnew GlugGlug(this, &HaHa::Pirate);
}
void Zomg()
{
dispatcher->Invoke(DispatcherPriority::Normal, glug);
dispatcher->Invoke(DispatcherPriority::Normal, zomg);
}
void Pooper() { }
void Pirate() { }
}
?