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
Templates mean
What is polymorphism used for?
What is encapsulation c#?
What is object and class in oops?
What is overriding in oops?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What is static in oop?
What is the real time example of encapsulation?
Why do we need oop?
What does enum stand for?
What is data binding in oops?
What is a null tree?
What is polymorphism in oop example?
Can we override main method?
How do you achieve polymorphism?