Answer Posted / sujatha
object can be destroyed by using DESTRUCTORS
EX:
class A
{
int p;
public:
A(int x)
{
x=p;
cout<<"constructor is called memory is allocated to
variable x\n";
}
void show()
{
cout<<"x="<<x;
}
~A()
{
cout<<"destructor called and deaalocte memory occupied by
x\n";
}
};
void main()
{
A a1(10);
a1.show();
}
output
constructor called memory is allocated to variable x
x=10
destructor called and deaalocte memory occupied by x
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
What does oop mean in snapchat?
What is encapsulation in simple terms?
What is variable example?
What is an advantage of polymorphism?
Why polymorphism is used in oops?
Describe these concepts: Polymorphism, Inheritance and Abstraction.
What is polymorphism used for?
What is polymorphism in oops with example?
What is abstract class in oops?
What does sksksk mean in text slang?
What is overriding in oops?
What is class and object in oops?
What is polymorphism programming?
What is balance factor?
write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.