What is object slicing and how can we prevent it?
Answer Posted / prits
When an instance of derived class is assigned to base class
instance object slicing takes place.ie in this case the
derived portion gets truncated and only the base portion
remains.
The problem of object slicing can be prevented by the use
of pure virtual functions.
| Is This Answer Correct ? | 38 Yes | 6 No |
Post New Answer View All Answers
What is the maximum combined length of command line arguments including the space between adjacent arguments?
Is swift a good first language?
Should the member functions which are made public in the base class be hidden?
What is prototype for that c string function?
What is the main purpose of c++?
Write a note about the virtual member function?
What is stream and its types in c++?
which operator is used for performing an exponential operation a) > b) ^ c) none
What is the average salary of a c++ programmer?
What is the difference between the functions rand(), random(), srand() and randomize()?
List different attributes in C++?
What is difference between rand () and srand ()?
What is diamond problem in c++?
Can comments be nested?
Write about the various sections of the executable image?