当前位置: 首页>>代码示例>>C++>>正文


C++ Computer::getAdditionalPartsList方法代码示例

本文整理汇总了C++中Computer::getAdditionalPartsList方法的典型用法代码示例。如果您正苦于以下问题:C++ Computer::getAdditionalPartsList方法的具体用法?C++ Computer::getAdditionalPartsList怎么用?C++ Computer::getAdditionalPartsList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Computer的用法示例。


在下文中一共展示了Computer::getAdditionalPartsList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: buildGamingComputerTest3

bool buildGamingComputerTest3()
{
    ComputerBuilder *builder = new GamingComputerBuilder();

    builder->createComputer();

    Computer *computer = builder->getResult();

    Part** list = computer->getAdditionalPartsList();

    for (int i = 0; i < computer->getNumberOfAdditionalParts(); ++i)
    {
        Part* part = list[i];
        if (part != 0)
        {
            // tests if Part is a BluRay drive
            if(dynamic_cast<BluRayDrive*>(part))
            {
                delete builder;
                delete computer;

                return true;
            }
        }
    }

    delete builder;
    delete computer;

    return false;
}
开发者ID:scyptnex,项目名称:computing,代码行数:31,代码来源:main.cpp

示例2: computerBluRayTest

bool computerBluRayTest()
{
    Computer* computer = new Computer();
    computer->setNumberOfAdditionalParts(1);
    computer->addAdditionalPart(BluRayDrive("LG Black 12X BD-ROM", 12));
    Part** parts = computer->getAdditionalPartsList();

    std::string expected = "Blu-ray Drive: LG Black 12X BD-ROM, Read Speed: 12X";
    std::string actual = std::string(parts[0]->getPartInformation());

    delete computer;
    return expected == actual;
}
开发者ID:scyptnex,项目名称:computing,代码行数:13,代码来源:main.cpp

示例3: computerFanTest

bool computerFanTest()
{
    Computer* computer = new Computer();
    computer->setNumberOfAdditionalParts(1);
    computer->addAdditionalPart(CoolingFan("Cooler Master SickleFlow 120 - Sleeve Bearing 120mm", 1600));
    Part** parts = computer->getAdditionalPartsList();

    std::string expected = "Cooling Fan: Cooler Master SickleFlow 120 - Sleeve Bearing 120mm, Speed: 1600 RPM";
    std::string actual = std::string(parts[0]->getPartInformation());

    delete computer;
    return expected == actual;
}
开发者ID:scyptnex,项目名称:computing,代码行数:13,代码来源:main.cpp

示例4: computerDVDDriveTest

bool computerDVDDriveTest()
{
    Computer* computer = new Computer();
    computer->setNumberOfAdditionalParts(1);
    computer->addAdditionalPart(DVDDrive("ASUS 24X DVD Burner", 16));
    Part** parts = computer->getAdditionalPartsList();

    std::string expected = "DVD Drive: ASUS 24X DVD Burner, Read Speed: 16X";
    std::string actual = std::string(parts[0]->getPartInformation());

    delete computer;
    return expected == actual;
}
开发者ID:scyptnex,项目名称:computing,代码行数:13,代码来源:main.cpp

示例5: computerWaterCoolingTest

bool computerWaterCoolingTest()
{
    Computer* computer = new Computer();
    computer->setNumberOfAdditionalParts(1);
    computer->addAdditionalPart(WaterCooling("CORSAIR Hydro Series H50 120mm", "CPU Block"));
    Part** parts = computer->getAdditionalPartsList();

    std::string expected = "Water Cooler: CORSAIR Hydro Series H50 120mm, Cooling Type: CPU Block";
    std::string actual = std::string(parts[0]->getPartInformation());

    delete computer;
    return expected == actual;
}
开发者ID:scyptnex,项目名称:computing,代码行数:13,代码来源:main.cpp


注:本文中的Computer::getAdditionalPartsList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。