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

Is it possible to provide default values while overloading a binary operator?

1322


How to access a variable of the structure?

1137


List the merits and demerits of declaring a nested class in C++?

1080


what is oops and list its features in c++?

1111


How do you establish a has-a relationship?

1169


What is the fastest c++ compiler?

1181


What is the importance of mutable keyword?

1075


Explain function overloading and operator overloading.

1120


What is lambda expression c++?

1120


Differentiate between late binding and early binding.

1339


Which sort does c++ use?

1077


Explain dangling pointer.

1188


What is the difference between multiple and multilevel inheritance in c++?

1179


Explain the isa and hasa class relationships. How would you implement each?

1180


Who invented turbo c++?

1114