1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // demo_polymorphic.cpp
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // should pass compilation and execution
13 #include <boost/archive/polymorphic_text_iarchive.hpp>
14 #include <boost/archive/polymorphic_text_oarchive.hpp>
16 #include <boost/archive/polymorphic_binary_iarchive.hpp>
17 #include <boost/archive/polymorphic_binary_oarchive.hpp>
19 #include "demo_polymorphic_A.hpp"
21 int main(int argc
, char* argv
[])
26 // test with a text archive
29 // instantiate archive which inhertis polymorphic interface
30 // and the normal text archive implementation
31 boost::archive::polymorphic_text_oarchive
oa(ss
);
32 boost::archive::polymorphic_oarchive
& oa_interface
= oa
;
33 // we can just just the interface for saving
37 // or we can use the implementation directly
38 boost::archive::polymorphic_text_iarchive
ia(ss
);
45 //test with a binary archive
48 // instantiate archive which inhertis polymorphic interface
49 // and the normal binary archive implementation
50 boost::archive::polymorphic_binary_oarchive
oa(ss
);
55 boost::archive::polymorphic_binary_iarchive
ia(ss
);
56 boost::archive::polymorphic_iarchive
& ia_interface
= ia
;
57 // use just the polymorphic interface for loading.