To add instance method from a type(class) we have to reference the instance type name.
using System;
delegate void Printer(int i);
class MyClass
{
public void consolePrinter(int i)
{
Console.WriteLine(i);
}
}
class Test
{
static void Main()
{
MyClass cls = new MyClass();
Printer p = cls.consolePrinter;
}
}
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |