Interface * base_ptr1 = new Derived1();
Interface * base_ptr2 = new Derived2();
In theory I should have serialize() method in all classes but my interface type class does not have data members, only abstract virtual methods.
Interface * base_ptr1 = new Derived1();
Interface * base_ptr2 = new Derived2();
In theory I should have serialize() method in all classes but my interface type class does not have data members, only abstract virtual methods.
You could add pure
virtualfunctions to do the serialization.Now, the concrete classes only needs to implement
readandwriteand the streaming operators implemented forInterfacewill work for them all.