| 网站首页 | 文章中心 | 电子书下载 | 矢量图库 | 视频教程 | 素材下载 | 程序代码下载 | JS代码 | 论坛 | 
常用软件类:
|杀毒安全 |联络聊天 |网络软件 |多媒体类 |系统工具 |图形图像 |系统工具 |应用软件 |行业软件
开发设计类:
|动画制作 |图像处理 |3D设计 |操作系统 |站长学院 |网络相关 |WEB设计 |数据库类 |程序开发
C#中结构与类的区别
作者:佚名    文章来源:网络    点击数:    更新时间:2006-12-9
  一.类与结构的示例比较:


  结构示例:





  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
  }


  }



  调用过程:



  public class Test
  {


  public static ovid Main


  {


  Person Myperson=new Person //声明结构


  TestTime Mytime=New TestTime //声明类


  }


  }

[1] [2] 下一页


相关文章