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 capacity in vector in c++?
Write a program which employs Recursion
Is there a c++ certification?
What is buffering in c++?
Write a struct time where integer m, h, s are its members?
What's the order in which the objects in an array are destructed?
What is the purpose of ios::basefield in the following statement?
What flag means?
What are the advantages of using a pointer? Define the operators that can be used with a pointer.
What is rvalue?
What are arithmetic operators?
What is c++ similar to?
What is the difference between struct and class?
What is c++ coding?
Why struct is used in c++?