您的位置:首页 > 移动开发 > Objective-C

38 派生类中的构造函数 object类,ToString

2013-05-07 21:22 351 查看
派生类中的构造函数(有参,无参)、

View Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
B c = new B();
c.A = 700;
string d = c.ToString();
Console.WriteLine(d);
}
}
class B
{
private int a;
public int A
{
get { return a; }
set { a = value; }
}
public virtual string ToString()
{
return "我是" + a;
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: