|
Boost Users : |
Subject: [Boost-users] pure virtual function call error
From: e120281 (mehbilgin_at_[hidden])
Date: 2009-03-11 03:09:09
class A
{
public:
int i;
A( int i ) { this->i = i; }
~A() {}
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
ar & i;
}
};
class B
{
public:
B() {}
~B()
{
std::string filename = "C:\\a2.txt";
const A a( 2 );
std::ofstream ofs( filename.c_str(), std::ios::out | std::ios::binary );
boost::archive::binary_oarchive boa( ofs );
boa << a;
}
static B* getInstance()
{
static B instance;
return &instance;
}
void serialize()
{
std::string filename = "C:\\a1.txt";
const A a( 1 );
std::ofstream ofs( filename.c_str(), std::ios::out | std::ios::binary );
boost::archive::binary_oarchive boa( ofs );
boa << a;
}
};
int main()
{
B* b = B::getInstance();
b->serialize();
}
When I run the above code in visual studio 2005 I get pure virtual function
call error.
If I comment out the line b->serialize(); then everything is ok.
What is wrong with the above code???
-- View this message in context: http://www.nabble.com/pure-virtual-function-call-error-tp22434024p22434024.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net