C#值的引用类型(二)及场景漫游

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是进行场景漫游的。另一些高级功能后面应该会提到。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值