[问题] 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