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
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
What is the basic difference between C and C++?
When we use Abstract Class and when we use Interface?where we will implement in real time?
What's the "software peter principleā?
Difference between pointer to constant vs. Pointer constant
What is scope in c++ with example?
Can you pass a vector to a function?
Does std endl flush?
Explain the pure virtual functions?
Distinguish between new and malloc and delete and free().
What is a local reference?
What are the advantages of using a pointer?
Explain "const" reference arguments in function?
Is arr and &arr are same expression for an array?
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass