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

Answer Posted / atul shankhwar

Slicing means that the data added by a subclass are discarded when an object of the subclass is passed or returned by value or from a function expecting a base class object.
Explanation:
Consider the following class declaration:
class base
{
...
base& operator =(const base&);
base (const base&);
}
void fun( )
{
base e=m;
e=m;
}
As base copy functions don't know anything about the derived only the base part of the derived is copied. This is commonly referred to as slicing. One reason to pass objects of classes in a hierarchy is to avoid slicing. Other reasons are to preserve polymorphic behavior and to gain efficiency.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is tellg () in c++?

1233


What's the order in which the local objects are destructed?

1197


Explain how functions are classified in C++ ?

1176


Where the memory to the static variables is allocated?

997


What is c++ runtime?

1045


What is the header file for setw?

1051


Why are pointers not used in c++?

1078


Are iterators pointers?

1099


what kind of projects are suitable for c and c++

989


Define friend function.

977


What do you mean by function and operator overloading in c++?

990


What are the various situations where a copy constructor is invoked?

1067


Which software is used for c++ programming?

1032


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

987


How do you declare A pointer to a function which receives nothing and returns nothing

1171