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
Do class declarations end with a semicolon? Do class method definitions?
What is the use of turbo c++?
How is computer programming useful in real life?
How static variables and local variablesare similar and dissimilar?
Is c++ the hardest language?
Why are pointers not used in c++?
What is an object in c++?
Why is main function important?
Why is standard template library used?
What are vtable and vptr?
What do the keywords volatile and mean mutable?
Can we use this pointer in a class specific, operator-overloading function for new operator?
What is a singleton c++?
Is map sorted c++?
What are different types of loops in c++?