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
Why c++ is better than c language?
What is a pointer with example?
Explain selection sorting. Also write an example.
What is c++ virtual inheritance?
Is it possible to write a c++ template to check for a function's existence?
What are c++ manipulators?
What's the hardest coding language?
What does namespace mean in c++?
What are the 4 types of library?
Why do we use setw in c++?
How do you sort a sort function in c++ to sort in descending order?
How do you declare a set in c++?
How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?
What is & in c++ function?
Can we overload operator in c++?