public class InterfaceManager
{
private static IVehicleCommunicationCtrl _bizCtrl = null;//为什么要定义方法的引用?不定义不是也可以访问方法么?
private static IGpsReceiveCtrl _gpsCtrl = null; public static IVehicleCommunicationCtrl GetVehicleCommunicationCtrl() //接口中定义静态方法有什么好处?
{...}
public static IGpsReceiveCtrl GetGpsReceiveCtrl()
{...} }
{
private static IVehicleCommunicationCtrl _bizCtrl = null;//为什么要定义方法的引用?不定义不是也可以访问方法么?
private static IGpsReceiveCtrl _gpsCtrl = null; public static IVehicleCommunicationCtrl GetVehicleCommunicationCtrl() //接口中定义静态方法有什么好处?
{...}
public static IGpsReceiveCtrl GetGpsReceiveCtrl()
{...} }
{
if (_bizCtrl == null)
{
_bizCtrl = new VehicleCommunicationCtrlClass();
}
}
{
private static IVehicleCommunicationCtrl _bizCtrl = null;
public static IVehicleCommunicationCtrl GetVehicleCommunicationCtrl()
{
if (_bizCtrl == null)
{
_bizCtrl = new VehicleCommunicationCtrlClass();
}
}
}那这样写有什么用么?