Oops For Cse - It Gdpi 2021
Oops For Cse - It Gdpi 2021
3. What is a class?
Ans:Class is a prototype or a template that has state and behavior supported by
an object and used in the creation of objects. For example, Human is a class with
the state as having a vertebral system, brain, color, and height and has behavior
such as canThink(), ableToSpeak(), etc.
4. What is an object?
Ans: An object is an instance of a class. It has its own state, behavior, and
identity.
8. What is a destructor?
Ans: A destructor is a method which is automatically called when the object is
made of scope or destroyed. The destructor name i the same as the class name
but with the tilde symbol before the name.
Finally Block- A finally block consists of code that is used to execute important
code such as closing a connection, etc. This block executes when the try block
exits. It also makes sure that finally block executes even in case some
unexpected exception is encountered.