几个问题
F11单步调试与F10逐步调试区别:单步调试会进入函数内部,逐步不会
F9设置断点
类相当于一个model,不能对model进行赋值操作。
通过属性过滤调一些不需要的数据
类中有字段,属性,方法
public string name;
public string ff
{
set { this.name = value; }
get { return this.name; }
//get { return this.name+"is a very good"; }
}
public int Speak()
{
Console.WriteLine("jingya is very good boy!");
return 1;
}
int 是定义返回值类型,void设置为空
people.we = "we";//静态字段直接可以引用,静态类下全是静态的,普通类下可以有静态的
类默认为public,字段默认private
继承:class man : people{}
值类型:
C# 中的局部变量之前,必须对其进行初始化。
int myInt = new int();
myInt = 0;
Point p = new Point();
引用类型 man m = new man();
这样的是引用类型
class Program
{
static void Main(string[] args)
{
people peo = new people();
//peo.age = 30并不能设置类的name和hair
man m = new man();
peo.fl = 20;
///peo.age = 30
m.gender = "ma";
m.fl = 40;
super.name = "ssss";
people.we = "we";//静态字段直接可以引用
Console.WriteLine(peo.fl);
Console.WriteLine(m.gender);
Console.WriteLine(m.fl);
Console.WriteLine(peo.fl);//不是指向同一个地址
Console.ReadKey();
}
}
class people//默认public
{
public static string we;//静态字段
private string hair;
protected string name;
public float fl;
int heigt;//默认private
}
class man : people
{
public string gender;
public string ff
{
set { this.name = value; }
get { return this.name; }
//get { return this.name+"is a very good"; }
}
}
public static class super//静态类
{
public static string name;
public static int Speak()
{
Console.WriteLine("jingya is very good boy!");
return 1;
}
}