Visual C++ 2005Visual C#的对比(委托的使用)

 

Visual C++ 2005:

 

interface class IShape

{

     void Draw();

}

 

ref class Circle:IShape

{

     Point center;

     int radius;

     void draw();

};

 

Circle^ c = gcnew Circle();

 

delegate void MyDelegate();

 

MyDelegate^ d = gcnew MyDelegate(c , &Circle::Draw)

 

Visual C#:

 

Interface IShape

{

     void Draw();

}

 

class Circle:IShape

{

     Point center;

     int radius;

     void draw();

};

 

Circle* c = new Circle();

 

delegate void MyDelegate();

 

MyDelegate d = new MyDelegate(c->Draw)

posted on 2008-09-04 03:29  开(^_^)心  阅读(229)  评论(0编辑  收藏  举报