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 is abstraction with example?

1171


Which type does string inherit from?

1160


Why is object oriented programming so hard?

1134


What are oops methods?

1075


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.

2243


What is the real life example of polymorphism?

1235


What is a class and object?

1108


Why do while loop is used?

1098


Is html an oop?

1125


What is abstraction encapsulation?

1200


How do you define social class?

1117


What are the 4 pillars of oop?

1204


Is data hiding and abstraction same?

1105


What are the benefits of polymorphism?

1364


what is the sylabus for priliminaries?

2225