Professional Documents
Culture Documents
Ans: it is stand for object oriented programming .it is use to develop software.in oop a programm is
designed by using objects. It is easy and flexible approach to designing and organizing programming. The
whole system is divided into a set of object.
For example
public:
}
Private Access: Private keyword, means that no one can access the class members declared private,
outside that class. If someone tries to access the private members of a class, they will get a compile time
error. By default class variables and member functions are private.
For example
private:
Protected Access: Protected access specifier is a stage between private and public access .it is used to
allow the access of class members and friend function of that class .
For example
protected:
The new operator is an operator which denotes a request for memory allocation on the Heap. If
sufficient memory is available, new operator initializes the memory and returns the address of
the newly allocated and initialized memory to the pointer variable
6. What is the difference between Constructor & Destructor
explains minimum 10 differences in tabular form?
Difference between Constructor and Destructor in C++ :
S.N
O CONSTRUCTOR DESTRUCTOR
Types of Constructors
There are three types of constructors: Default, No-arg constructor and
Parameterized.
Default constructor
If you do not implement any constructor in your class, Java compiler inserts a
default constructer into your code on your behalf. This constructor is known as
default constructor. You would not find it in your source code(the java file) as it
would be inserted into the code during compilation and exists in .class file
no-arg constructor:
Constructor with no arguments is known as no-arg constructor. The signature
is same as default constructor; however body can have any code unlike default
constructor where the body of the constructor is empty.
CLASS STRUCTURE
allocated on heap memory. All the value types are allocated on stack memory.
cheaper than allocation of large Allocation and de-allocation is cheaper in value type as
Classes can contain constructor or destructor, but can contain Parameterized constructor or