What is object slicing and how can we prevent it?
Answer Posted / 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 |
Post New Answer View All Answers
What is meant by the term name mangling in c++?
Is java the same as c++?
Explain the difference between using macro and inline functions?
What is c++ flowchart?
Is c++ used anymore?
How can you quickly find the number of elements stored in a dynamic array? Why is it difficult to store linked list in an array?
How can you quickly find the number of elements stored in a dynamic array?
Why are arrays usually processed with for loop?
If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?
Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?
Should the member functions which are made public in the base class be hidden?
What is #include c++?
Why are pointers not used in c++?
What is microsoft c++ redistributable?
What are the types of pointer?