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?



What is slicing?..

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

More C++ General Interview Questions

What are the various access specifiers in c++?

0 Answers  


What is the function of I/O library in C++ ?

0 Answers   HCL,


Describe public access specifiers?

0 Answers  


what is the behaviour of C and C++ compiler for the below statements. int *p; p = malloc(100); Is the behaviour same ? or different ?

2 Answers  


Explain storage qualifiers in c++.

0 Answers  


What is a storage class used in c++?

0 Answers  


Is there a new/delete equivalent of realloc?

1 Answers  


Describe run-time type identification?

1 Answers  


how to create window program in c++.please explain.

1 Answers   Microsoft,


what is importance of data sturture in a programming language?

22 Answers   L&T, TCS, Wipro,


What is conditions when using boolean operators?

0 Answers  


What are the vectors in c++?

0 Answers  


Categories