Пример #1
0
 // create a trike and ride it
 int main()
 {
Tricycle wichita;
 wichita.setSpeed(0);
 wichita.pedal();
 wichita.pedal();
 wichita.brake();
 wichita.brake();
 wichita.brake();
 Tricycle t;
 t.setSpeed(100);
 t.pedal();
 t.pedal();
 t.pedal();
 t.pedal();
 t.brake();
 return 0;
}
Пример #2
0
int main()
{
    std::cout << "Creating trike named wichita ...";
    Tricycle wichita;
    wichita.pedal();
    std::cout << "Creating trike named dallas ...\n";
    Tricycle dallas(wichita);
    std::cout << "wichita's speed: " << wichita.getSpeed() << "\n";
    std::cout << "dallas's speed: " << dallas.getSpeed() << "\n";
    std::cout << "setting wichita to 10 ...\n";
    wichita.setSpeed(10);
    std::cout << "wichita's speed: " << wichita.getSpeed() << "\n";
    std::cout << "dallas's speed: " << dallas.getSpeed() << "\n";
    return 0;
}