Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is object slicing?

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


Please Help Members By Posting Answers For Below Questions

What does it mean when someone says I oop?

1063


Can we create object of interface?

1133


What is class and object with example?

1132


What are the advantages of polymorphism?

1033


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1860


What is meant by oops concept?

1044


Why multiple inheritance is not allowed?

1158


How many human genes are polymorphic?

1067


How to use CMutex, CSemaphore in VC++ MFC

4786


Whats oop mean?

1042


What are the 4 main oop principles?

1225


What are the benefits of polymorphism?

1276


Write a c++ program to display pass and fail for three student using static member function

3400


What is oops and why we use oops?

1049


What is data binding in oops?

1099