Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
Tricycle::Tricycle(const Tricycle& rhs)
{
    speed = new int;
    *speed = rhs.getSpeed();
}