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 / debashis mishra,india,orissa

if an object of a derived class is assigned to a base class
object,the compiler accepts it.but it copies only the base
portion of the object
class base
{
public:
int i,j;
};
class derived : public base
{
private:
int k;
};
int main()
{
base b;
derived d;
b=d;
return o;
}
here b contains i and j where as d contains i,j&k.On
assignment only i and j of the d get copied into i and j of
b. k doesnot be copied. on the effect object d got sliced.

Is This Answer Correct ?    46 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is advantage of inheritance?

1174


What is class in oop with example?

1100


What is class and example?

1186


write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.

2243


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6679


What is the difference between encapsulation and polymorphism?

1111


What are the benefits of polymorphism?

1276


What does and I oop mean?

1186


Why do we need oop?

1202


What is pointer in oop?

1056


write a programe to calculate the simple intrest and compund intrest using by function overlading

2205


What is meant by oops concept?

1044


What are the benefits of interface?

1061


what is the drawback of classical methods in oops?

3381


What is the main purpose of inheritance law?

1199