When is a memory allocated to a class?

Answers were Sorted based on User's Feedback



When is a memory allocated to a class?..

Answer / teginder

When instance of that class is creater by us

Is This Answer Correct ?    30 Yes 5 No

When is a memory allocated to a class?..

Answer / vineet makkar

The answer to this question lies in the basic difference
between
OBJECT & INSTANCE

INSTANCE : Refers to a reference of an object, it can be
null.

OBJECT: Actually pointing to the memory address of that
instance.

eg
Student stdnt; // Instance is created
Student stdnt = new Student; // Object is created

So, in short, memory is allocated to a class when the
object of the class is created using "new" keyword.

Is This Answer Correct ?    26 Yes 3 No

When is a memory allocated to a class?..

Answer / ramakrishna

A class is a template.As Teginder said,it will get
allocated memory when u create object of that class.

Is This Answer Correct ?    22 Yes 5 No

When is a memory allocated to a class?..

Answer / achal

when an object of that class is created and constructor
runs. memory is allocated in Stack (part of RAM)

Is This Answer Correct ?    13 Yes 3 No

When is a memory allocated to a class?..

Answer / anumohan

when instance of that class is created by creating object
to the class

Is This Answer Correct ?    11 Yes 3 No

When is a memory allocated to a class?..

Answer / namrata ahuja

when the object of that class is declared.

Is This Answer Correct ?    7 Yes 5 No

When is a memory allocated to a class?..

Answer / saurabh

when we create the data member of the class by using d syntax
class
{




static int a;
};
static int a;

Is This Answer Correct ?    3 Yes 1 No

When is a memory allocated to a class?..

Answer / x

It is allocated compile-time unless we are using new and
delete functions

Is This Answer Correct ?    3 Yes 1 No

When is a memory allocated to a class?..

Answer / b

when an object is intantiated from a class

Is This Answer Correct ?    0 Yes 0 No

When is a memory allocated to a class?..

Answer / sourav das

when object is created of that class then only memory is
allocated.with out object there is no Existence of class.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

In which Scenario you will go for Interface or Abstract Class?

1 Answers   InfoAxon Technologies,


What is encapsulation in simple terms?

0 Answers  


What do we mean by a hidden argument in a function?

1 Answers   TCL,


What is destructor example?

0 Answers  


What is abstraction with example?

0 Answers  






Why do we need oop?

0 Answers  


Can private class be inherited?

0 Answers  


sir i want to know which posting to apply since i am BE CSE.. also want to know what are the rounds there for my interview...Expecting for ur valuable answer....

2 Answers  


Should you protect the global data in threads? Why or why not?

2 Answers   IBM,


what is Class in oops with example?

4 Answers   HCL,


What does sksksk mean in text slang?

0 Answers  


Why is polymorphism needed?

0 Answers  


Categories