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 |
Are php strings immutable?
What are the differences between java and c++?
Comment on assignment operator in c++.
What is meant by the term name mangling in c++?
Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be
What are stacks?
Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.
What is the extraction operator and what does it do?
I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.
What is the maximum combined length of command line arguments including the space between adjacent arguments?
sir i want to study the c++ course but ino what is the qualification and the study methode please reply more details in c++
What is heap sort in c++?