📄 program.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
namespace 使用非public修饰父类成员
{
/************************
* 程序描述:继承实例。子类student和techer从person继承了id、sex、name三个成员
* 另外还分别定义了自己的成员。
* 创 建 人:ncbcy@eiTarget
* 版 本 号:1.0.0
* 修改记录:0
***********************/
class Program
{
static void Main(string[] args)
{
student st = new student();
st.SetValue(009, "骆");
st.ViewValue();
Console.ReadLine();
}
}
class person
{
protected int id;
}
class student : person
{
private string name;
public void SetValue(int id, string name)
{
this.id = id;
this.name = name;
}
public void ViewValue()
{
Console.WriteLine("Name:\t" + name + "\nID:\t" + id);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -