⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 st2main.cpp

📁 c#设计模式WithCla
💻 CPP
字号:
#include "controll.h"
#include <iostream.h>
#include <cstring.h>

int main ()
{
/* 
  //Use with ST2STATE.OMT and ST2HEAD1.SCT, ST2FUNC1.SCT, ST2HEAD2.SCT, and ST2FUNC2.SCT        
  Controller controller1;
  try {
		 controller1.process (turnOn);}
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; }

  try {
		 controller1.process (turnOff); }
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; }
  return 0;
*/

  //Use with ST2STATE.OMT and ST2HEAD3.SCT and ST2FUNC3.SCT, ST2HEAD5.SCT, ST2FUNC5.SCT 
  Controller controller1;
  try {
		 controller1.turnOn (1);  }
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; }

  try {
		 controller1.turnOff (); }
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; }

  return 0;
/*
  //Use with ST2STATE.OMT and ST2HEAD4.SCT and ST2FUNC4.SCT     
  pOffState = new OffState();
  pOnState = new OnState();
  State *pCurrentState;
  pCurrentState = pOffState;
  
  try {
		 pCurrentState = pCurrentState->turnOn(1); }
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; } 

  try {     
		 pCurrentState = pCurrentState->turnOff(); } 
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; }  

  return 0;
*/
/*
  //Use with ST2STATE.OMT and ST2HEAD5.SCT and ST2FUNC5.SCT 	
  Controller controller1;	
  try {
	 controller1.turnOn(1); }
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; } 

  try {     
	 controller1.turnOff(); } 
  catch (string eventError) { cout << eventError << "Cannot process event" << endl; }  

  return 0;
*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -