C#中继承关系
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
class Father
{
//public Father()
//{
//}
public Father(int i)
{
Debug.Log("Father构造");
}
}
class Son:Father
{
public Son(int i):base(i)
{
Debug.Log("Son的一个参数的构造");
}
public Son(int i,string str):this(i)
{
Debug.Log("Son的两个参数的构造");
}
}
public class Fathers : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Son myson = new Son(12, "hello");
}
// Update is called once per frame
void Update()
{
}
}