Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
simple serialization
#include<iostream> #include<fstream> class One { public: int a; virtual void Func() { } }; class One1: public One { char s[128]; void Func1(int l) { std::cout<<l<<'\n'; } void Func() { Func1(156); } }; int main() { One* x = new One1; x->Func(); char* y=(char*)x; //delete x; std::ofstream out("test11.txt",std::ofstream::out | std::ofstream::trunc); out.write(y,sizeof(One1)); out.close(); std::ifstream in("test11.txt",std::ifstream::in); char* y1=new char[sizeof(One1)]; in.read(y1,sizeof(One1)); One* z=(One*)y/*1*/; z->Func(); return 0; }
run
|
edit
|
history
|
help
0
顺序表的实现——静态分配
mua
find first non repeating
PascalTriangle
q
FindMissingLagrange
decode
GenericPacker
inheritance
StackListHi