Object initialization
I works on embedded software.  Previously we don't use too many C++ features so we use memset(this,0,sizeof(child)) to initialize(zero out) a object.  However it doesn't work now since we are using virtual functions.  Apparently it would destroy the vtable/virtual pointer.

So my question is:
How can I initialize an object quickly and conveniently?

The class child inherits from class parent, which defines a lot virtual functions, and got many data member.  If I need only to zero out all data member, any way to avoid member-by-memeber assignment in child's constructor without using memset()?  or any trick to use memset without destroying vtable? (compiler-independent way)

Thank you very much.





Object initialization
===

I works on embedded software.  Previously we don't use too many C++ features so we use memset(this,0,sizeof(child)) to initialize(zero out) a object.  However it doesn't work now since we are using virtual functions.  Apparently it would destroy the vtable/virtual pointer.

So my question is:
How can I initialize an object quickly and conveniently?

The class child inherits from class parent, which defines a lot virtual functions, and got many data member.  If I need only to zero out all data member, any way to avoid member-by-memeber assignment in child's constructor without using memset()?  or any trick to use memset without destroying vtable? (compiler-independent way)

Thank you very much.




