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
What is the purpose of enum?
Which is better struts or spring?
How can you overcome the diamond problem in inheritance?
What is the point of polymorphism?
write a program that takes input in digits and display the result in words from 1 to 1000
What is coupling in oops?
Can bst contain duplicates?
What does and I oop mean in text?
What is encapsulation example?
What is a function in oop?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is the importance of oop?
Why is there no multiple inheritance?
What is inheritance in simple words?
What is overriding in oops?