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 |
What is meant by the term name mangling in c++?
what is the use of void main() in C++ language?
Can c++ be faster than c?
sir there is some problem with nokia5130c-2,when we are trying to upload movies from net then there is a error occurred"FORMAT NOT SUPPORTED" bt its all ready in 3gp format.please tell me what i do now?
Explain the scope resolution operator?
What is a reference in C++?
What is the size of pointer ? Also size of pointer in 64 bit pointer
How can you link a c program with a c function?
What is c++ code?
Describe the process of creation and destruction of a derived class object?
Explain the difference between realloc() and free() in c++?
Write a program that read 2o numbers in and array and output the second largest number. Can anybody help??