本文整理汇总了C++中Engine::ConnectToNext方法的典型用法代码示例。如果您正苦于以下问题:C++ Engine::ConnectToNext方法的具体用法?C++ Engine::ConnectToNext怎么用?C++ Engine::ConnectToNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine::ConnectToNext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
int speed = 0;
try
{
Engine *engine = new Engine(speed);
FreightCar *car1 = new FreightCar;
FreightCar *car2 = new FreightCar;
FreightCar *car3 = new FreightCar;
engine->ConnectToNext(car1);
car1->ConnectToNext(NULL);
car2->ConnectToNext(car3);
car1->addFreight(20);
car2->addFreight(30);
car1->removeFreight(10);
engine->changeSpeed(30);
car2->getSpeed();
car1->removeFreight(10);
car2->ShowAll(cout);
system("pause");
}
catch (const char * exc)
{
cout << exc << endl;
system("pause");
}
return 0;
}