What is object slicing and how can we prevent it?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vikas
Object slicing occurs when we assign an instance of the
subclass to a variable of type base class.
http://www.cppquestions.com/viewtopic.php?f=17&t=49
| Is This Answer Correct ? | 12 Yes | 9 No |
Difference between shift left and shift right?
Define inline function
What is lambda in c++?
Why c++ is so important?
Tell me an example where stacks are useful?
Is python written in c or c++?
Define pre-condition and post-condition to a member function in c++?
What is the use of structure in c++?
What is a terminating character in c++?
How do you test your code?
which is best institue to learn C/C++ IN AMEERPET OR MAITHRIVANAM OR SR NAGAR, PLEASE HELP. THANKS IN ADVANCE
What does ios :: app do in c++?