What is object slicing and how can we prevent it?

Answer Posted / vikas

Object slicing occurs when we assign an instance of the
subclass to a variable of type base class.

http://www.cppquestions.com/viewtopic.php?f=17&t=49

Is This Answer Correct ?    12 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the keyword auto for?

575


Is ca high or low level language?

586


What programming language should I learn first?

594


What is object in c++ wikipedia?

575


What's c++ used for?

602






What are the advantages of c++ over c?

586


Differentiate between realloc() and free().

600


In c++, what is the difference between method overloading and method overriding?

603


What is a rooted hierarchy?

687


Write about the access privileges in c++ and also mention about its default access level?

619


What is istream c++?

577


What is a class definition?

618


What is endl?

641


declare an array of structure where the members of the structure are integer variable float variable integer array char variable access all elements of the structure using dot operator and this pointer operator

1743


Should the this pointer can be used in the constructor?

558