C#多接口类继承
父类
- using UnityEngine;
- using System.Collections;
- public class Vehicle {
- private float Speed;
- private float MaxSpeed;
- private float Weight;
- public void Run()
- {
- Debug.Log("Vehicle-Run");
- }
- public float speed{
- set{
- Speed=value;
- }
- get{
- return Speed;
- }
- }
- public float maxspeed{
- set{
- MaxSpeed=value;
- }
- get{
- return MaxSpeed;
- }
- }
- public float weight{
- set{
- Weight=value;
- }
- get{
- return Weight;
- }
- }
- public void Stop()
- {
- Debug.Log("Vehicle-Stop");
- }
- }
子类+接口继承
- using UnityEngine;
- using System.Collections;
- interface chj
- {
- void bbb();
- }
- interface chj1
- {
- int ccc();
- void bbb();
- }
- interface chj2:chj
- {
- void ced();
- }
- public class jiekou:Vehicle,chj1,chj2 {
- public int a;
- void chj.bbb()
- {
- Debug.Log ("chj->bbb");
- }
- void chj1.bbb()
- {
- Debug.Log ("chj1->bbb");
- }
- public void ced()
- {
- }
- public int ccc()
- {
- a = 100;
- return a;
- }
- }