[問題] function語法問題

作者: Ommm5566 (56天團)   2016-07-19 07:51:38
不好意思小弟沒學過cs 希望這問題不要鞭太大力
已經定義了class Context 和 abstract class State
public class ConcreteStateA : State
{
public ConcreteStateA(Context theContext):base(theContext)
{}
....
(略)
....
第一個冒號我知道是繼承
第二個冒號:base(theContext) 不是繼承吧? 這是做甚麼的????
附上context 和 state的碼
using UnityEngine;
using System.Collections;
namespace DesignPattern_State
{
// 持有目前的狀態,並將有關的訊息傳給狀態
public class Context
{
State m_State = null;
public void Request(int Value)
{
m_State.Handle(Value);
}
public void SetState(State theState )
{
Debug.Log ("Context.SetState:" + theState);
m_State = theState;
}
}
// 負責封裝當Context處於特定狀態時所該展現的行為
public abstract class State
{
protected Context m_Context = null;
public State(Context theContext)
{
m_Context = theContext;
}
public abstract void Handle(int Value);
}
....
(略)
....
作者: kevintsengtw (mrkt)   2016-07-19 09:13:00
MSDN C# 建構式 https://goo.gl/8mtj1T

Links booklink

Contact Us: admin [ a t ] ucptt.com