コード例 #1
0
TEST_F(BoomStickTest, MoveConstructor) {
   BoomStick firstObject{mAddress};
   MockSkelleton target{mAddress};

   ASSERT_TRUE(target.Initialize());
   ASSERT_TRUE(firstObject.Initialize());

   target.BeginListenAndRepeat();
   runIterations(firstObject, 100);

   BoomStick secondObject(std::move(firstObject));

   runIterations(secondObject, 100);

   target.EndListendAndRepeat();
}
コード例 #2
0
int main()
{
    MyClass myObject;
    std::cout << "myObject's age: " << myObject.GetAge() << "\n";
    std::cout << "Setting myObject to 6...\n";
    myObject.SetAge(6);
    std::cout << "Creating secondObject from myObject\n";
    MyClass secondObject(myObject);
    std::cout << "myObject's age: " << myObject.GetAge() << "\n";
    std::cout << "secondObject' age: " << secondObject.GetAge() << "\n";
    std::cout << "setting myObject to 7...\n";
    myObject.SetAge(7);
    std::cout << "myObject's age: " << myObject.GetAge() << "\n";
    std::cout << "boot's age: " << secondObject.GetAge() << "\n";

    getch();
    return 0;
}