Answer Posted / rsn
When a Derived Class object is assigned to Base class, the
base class' contents in the derived object are copied to
the base class leaving behind the derived class specific
contents. This is referred as Object Slicing.
Class Base
{
public:
int i;
};
class Derived : public Base
{
public:
int j;
};
int main()
{
Base Bobj;
Derived Dobj;
Bobj = Dobj; //Here Dobj contains both i and j.
//But only i is copied to Bobj.
}
| Is This Answer Correct ? | 126 Yes | 10 No |
Post New Answer View All Answers
What does it mean when someone says I oop?
Can we create object of interface?
What is class and object with example?
What are the advantages of polymorphism?
i=20;k=0;
for(j=1;k-i;k+=j<10?4:3)
{
cout< What is meant by oops concept? Why multiple inheritance is not allowed? How many human genes are polymorphic? How to use CMutex, CSemaphore in VC++ MFC Whats oop mean? What are the 4 main oop principles? What are the benefits of polymorphism? Write a c++ program to display pass and fail for three
student using static member function What is oops and why we use oops? What is data binding in oops?