S
schneider
Hi all,
class A contains a function "test". the delegate instance in class B
is set to a.test. Now, I want to hand over this delegate from class B
to class C. How can I accomplish this? When I try, the compiler says
CS0029: Cannot implicitly convert type 'B.the_del' to 'C.the_del'.
Here's the code:
class A
{
B b;
public A()
{
b = new B();
b.the_del = this.test; // works fine
}
public void test(int i)
{
}
}
class B
{
C c;
public B()
{
c = new C();
c.the_del = this.the_del; // CS0029
}
public delegate void testDel(int i);
public testDel the_del;
}
class C
{
public delegate void testDel(int i);
public testDel the_del;
}
Thanks in advance.
Cheers, Hannes
class A contains a function "test". the delegate instance in class B
is set to a.test. Now, I want to hand over this delegate from class B
to class C. How can I accomplish this? When I try, the compiler says
CS0029: Cannot implicitly convert type 'B.the_del' to 'C.the_del'.
Here's the code:
class A
{
B b;
public A()
{
b = new B();
b.the_del = this.test; // works fine
}
public void test(int i)
{
}
}
class B
{
C c;
public B()
{
c = new C();
c.the_del = this.the_del; // CS0029
}
public delegate void testDel(int i);
public testDel the_del;
}
class C
{
public delegate void testDel(int i);
public testDel the_del;
}
Thanks in advance.
Cheers, Hannes