using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace lesson4
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
??????????? var person = new Person(5);
??????????? Console.WriteLine(person.GetAge());
??????????? Console.WriteLine(Person.GetFive());
??????????? Console.WriteLine(person.Age);
??????????? person.Age = 10;
??????????? Console.WriteLine(person.GetAge());
??????????? Console.WriteLine(person.GetName());
??????????? Console.ReadLine();
??????? }
??? }
??? //默认internal
??? class Person:man,ISuper
??? {
??????? int age;//成员变量,不可操作
??????? public int Age//属性,可以操做,也可赋值,实现一个安全性
??????? {
??????????? set {
??????????????? age = value - 10;//这里的value是一个赋给他的值 ,例如上面的10
??????????? }
??????????? get {
??????????????? return age + 10;
??????????? }
??????? }
??????? public Person(int myAge)
??????? {
??????????? age = myAge;
??????? }
??????? public int GetAge()
??????? {
??????????? return age;
??????? }
??????? //静态的方法是存储在类上,并不是实例化的对象来调用的
??????? public static int GetFive()
??????? {
??????????? return 5;
??????? }
??????? public int GetSuper()
??????? {
??????????? return age + 100;
??????? }
??????? public override int GetMan()
??????? {
??????????? return 50;
??????? }
??? }
??? interface ISuper{
??????? int GetSuper();
??? }
??? abstract class man
??? {
??????? public string name;
??????? public string GetName() {
??????????? return name;
??????? }
??????? public abstract int GetMan();
??? }
}
接口和抽象类是和JAVA差不多的具体参考我之前的文章
另外在场景漫游中,QWER这4个键是改变物体的形状位置,还有按住鼠标右键QEWASD是进行场景漫游的。另一些高级功能后面应该会提到。
?