C++ interview questions including deep copy, shallow copy, copy constructor

Constructor: How to implement c++’s class’s constructor using the struct in c? #include #include struct PARENT_vtable { int (*Init)(); int (*Add)(); }; struct CHILD_vtable { int (*Init)();//child will override int (*Add)();//parent will define int (*Sub)();//child will define }; int parent_doInit() { printf(“parent init\n”); } int child_doInit() { printf(“child init\n”); } int parent_doAdd() { printf(“parent add\n”); …

C++ interview questions including deep copy, shallow copy, copy constructor Read More »