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 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


Please Help Members By Posting Answers For Below Questions

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?

2040


What is the basic difference between C and C++?

1192


When we use Abstract Class and when we use Interface?where we will implement in real time?

2194


What's the "software peter principleā€?

1158


Difference between pointer to constant vs. Pointer constant

1144


What is scope in c++ with example?

1127


Can you pass a vector to a function?

992


Does std endl flush?

1052


Explain the pure virtual functions?

1136


Distinguish between new and malloc and delete and free().

1032


What is a local reference?

1197


What are the advantages of using a pointer?

1088


Explain "const" reference arguments in function?

1076


Is arr and &arr are same expression for an array?

1068


What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass

1205