赞
踩
- using UnityEngine;
-
- public class HideMemeber : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- Debug.Log("-------------------------------");
- Humanoid human = new Humanoid();
- Humanoid enemy = new Enemy();
- Humanoid orc = new Orc();
-
- //注意每个 Humanoid 变量如何包含
- //对继承层级视图中
- //不同类的引用,但每个变量都
- //调用 Humanoid Yell() 方法。
- human.Yell();
- enemy.Yell();
- orc.Yell();
-
- Debug.Log("-------------------------------");
- Humanoid human1 = new Humanoid();
- Enemy enemy1 = new Enemy();
- Orc orc1 = new Orc();
- human1.Yell();
- enemy1.Yell();
- orc1.Yell();
-
-
-
-
-
- }
-
- // Update is called once per frame
- void Update()
- {
-
- }
- }
-
- public class Humanoid
- {
- //Yell 方法的基版本
- public void Yell()
- {
- Debug.Log("Humanoid versi
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。