Answer Posted / rsn
When a Derived Class object is assigned to Base class, the
base class' contents in the derived object are copied to
the base class leaving behind the derived class specific
contents. This is referred as Object Slicing.
Class Base
{
public:
int i;
};
class Derived : public Base
{
public:
int j;
};
int main()
{
Base Bobj;
Derived Dobj;
Bobj = Dobj; //Here Dobj contains both i and j.
//But only i is copied to Bobj.
}
Is This Answer Correct ? | 126 Yes | 10 No |
Post New Answer View All Answers
Can private class be inherited?
Advantage and disadvantage of routing in telecom sector
why reinterpret cast is considered dangerous?
What are properties in oop?
What are main features of oop?
What is for loop and its syntax?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
Explain the advantages of inheritance.
What is overriding in oop?
What is oops and why we use oops?
How do you answer polymorphism?
What is encapsulation selenium?
Why do we use polymorphism in oops?
class type to basic type conversion
What is a function in oop?