码迷,mamicode.com
首页 > 其他好文 > 详细

面向对象

时间:2015-09-23 23:30:15      阅读:371      评论:0      收藏:0      [点我收藏+]

标签:

class shangpin    定义类
{
       string id;  
       string name;
         double jiage; 
        string chandi;
         public shangpin()
{

{
public shangpin(string id, string name) 
}
this id =id;
this name = name;
{
public string Id 
}
get
{
return id;
}
}
  public string Name
{
get
{
return name;

}
set
{
name=value;
}





定义一个方法
public string show ()

{
return"商品编号:" + id.ToString() + "商品名称:" + name + "商品价格:" + price;
}

没写完 不知道怎么写了 ORZ

 

面向对象

标签:

原文地址:http://www.cnblogs.com/sunlei1993/p/4833880.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!