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 overloading in oop?
write a C++ program for booking using constructor and destructor.
class type to basic type conversion
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
write a programe to calculate the simple intrest and compund intrest using by function overlading
What are the 4 main oop principles?
What is protected in oop?
What is difference between data abstraction and encapsulation?
What is variable example?
Whats oop mean?
Prepare me a program for the animation of train
What is purpose of inheritance?
Which is not an object oriented programming language?
State what is encapsulation and friend function?
Can a varargs method be overloaded?