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 is abstraction with example?
Which type does string inherit from?
Why is object oriented programming so hard?
What are oops methods?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
What is the real life example of polymorphism?
What is a class and object?
Why do while loop is used?
Is html an oop?
What is abstraction encapsulation?
How do you define social class?
What are the 4 pillars of oop?
Is data hiding and abstraction same?
What are the benefits of polymorphism?
what is the sylabus for priliminaries?