mirror of
https://github.com/boostorg/contract.git
synced 2026-01-24 17:52:41 +00:00
50 lines
1.4 KiB
C++
Executable File
50 lines
1.4 KiB
C++
Executable File
|
|
// Copyright (C) 2008-2012 Lorenzo Caminiti
|
|
// Distributed under the Boost Software License, Version 1.0
|
|
// (see accompanying file LICENSE_1_0.txt or a copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
// Home at http://sourceforge.net/projects/contractpp
|
|
|
|
//[mitchell02_courier
|
|
// File: courier.cpp
|
|
#include "courier.hpp"
|
|
|
|
// Courier.
|
|
|
|
double courier::min_insurance_dollar = 10.0e+6;
|
|
|
|
CONTRACT_CONSTRUCTOR_BODY(courier, courier) (
|
|
double const an_insurance_cover_dollar )
|
|
{
|
|
insurance_cover_dollar_ = an_insurance_cover_dollar;
|
|
}
|
|
|
|
CONTRACT_DESTRUCTOR_BODY(courier, ~courier) ( void ) {}
|
|
|
|
double CONTRACT_MEMBER_BODY(courier, insurance_cover_dollar) ( void ) const
|
|
{ return insurance_cover_dollar_; }
|
|
|
|
void CONTRACT_MEMBER_BODY(courier, deliver) ( package& the_package,
|
|
std::string const destination )
|
|
{
|
|
the_package.location = destination;
|
|
// Delivery takes 2.5 hours.
|
|
the_package.delivered_hour = the_package.accepted_hour + 2.5;
|
|
}
|
|
|
|
// Different courier.
|
|
|
|
double different_courier::different_insurance_dollar = 20.0e+6;
|
|
|
|
CONTRACT_DESTRUCTOR_BODY(different_courier, ~different_courier) ( void ) {}
|
|
|
|
void CONTRACT_MEMBER_BODY(different_courier, deliver) ( package& the_package,
|
|
std::string const destination )
|
|
{
|
|
the_package.location = destination;
|
|
// Delivery takes only 0.5 hours.
|
|
the_package.delivered_hour = the_package.accepted_hour + 0.5;
|
|
}
|
|
//]
|
|
|