E
Edward Diener
Does the += notation for adding delegates to a delegate pointer object work
even if the delegate pointer is 0 ? As an example:
__gc class SomeObjectClass { public: void SomeObjectMethod() { } };
SomeObjectClass * someObjectPointer(new SomeObjectClass);
__delegate void MyDelegate();
MyDelegate * dobject(0);
dobject += new
MyDelegate(someObjectPointer,&SomeObjectClass::SomeObjectMethod); // Is this
valid ?
or does one have to check for the 0 pointer and write:
if (dobject) { dobject += new MyDelegate(someObjectPointer
*,&SomeObjectClass::SomeObjectMethod); }
else { dobject = new MyDelegate(someObjectPointer
*,&SomeObjectClass::SomeObjectMethod); }
even if the delegate pointer is 0 ? As an example:
__gc class SomeObjectClass { public: void SomeObjectMethod() { } };
SomeObjectClass * someObjectPointer(new SomeObjectClass);
__delegate void MyDelegate();
MyDelegate * dobject(0);
dobject += new
MyDelegate(someObjectPointer,&SomeObjectClass::SomeObjectMethod); // Is this
valid ?
or does one have to check for the 0 pointer and write:
if (dobject) { dobject += new MyDelegate(someObjectPointer
*,&SomeObjectClass::SomeObjectMethod); }
else { dobject = new MyDelegate(someObjectPointer
*,&SomeObjectClass::SomeObjectMethod); }