c#中结构与类的区别[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 lm20224 的 blog

c#中结构与类的区别

目录

   类与结构的实例比较

   类与结构的差别

   如何选择结构还是类

 

一.类与结构的示例比较:

结构示例:

public struct person

{

   string name;

   int  height;

   int  weight

public bool overweight()

{

    //implement something

}

}

  类示例:

   public class testtime

   {

 int hours;

 int minutes;

 int seconds;

 

public void passtime()

{

  //implementation of behavior

}

   }

 调用过程:

本文关键:c#中结构与类的区别
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top