第三次

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


namespace ConsoleApplication2
{
class Program
{
public static void Change(int a1,ref int b1,out int c1)
{
a1 =1;
b1 =2;
c1 =3;
}
//必须要加上static

static void Main(string[] args)
{
int a1 = 0;
int b1 = 0;
int c1;
Change(a1,ref b1,out c1);
Console.WriteLine("{0},{1},{2}",a1,b1,c1);//尝试ref和out


A a = new A();
B b = new B();
a.print();
b.print();//override

MyClass my = new MyClass();
/* my.MyProperty(){ set(1);
get();这个不会不知道怎么弄- -!
}*/
Console.ReadLine();

}
}
}
public class A
{
public virtual void print()
{
Console.WriteLine("Parent Method");
}
}

public class B : A
{
public override void print()
{
Console.WriteLine("Overriding child method");
}
}

class MyClass
{
private int myProperty = 0; //存储属性的私有成员
public int MyProperty //属性
{
get { return this.myProperty; } //get 属性
set { this.myProperty = value; } //set 属性
}
}

原文地址:https://www.cnblogs.com/zeromaiko/p/4379009.html