c++ - Suppose i created three or four object of a class study then memory will be created seperatly or not? -


here

class study {      data member;      member function; };  main() {     study s1, s2, s3; } 

it create 3 object of class study memory created seperatly seperate object or not in c++

not quite sure you're asking here but...

obviously s1,s2 , s3 each occupy different areas of memory.

however, memory allocated them on stack, there no calls malloc()/new() 'allocate' memory.

allocating memory off stack fast (just subtraction stack pointer) allocate 3 'studys' there typically single assembler instruction sub 3*sizeof(study) sp.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -