C++ Struct is compiled into class? -


i working on c++. using mvsv 2010.

when compile source code , dump memory layout of class -d1reportallclasslayout.

for example, declare struct:

struct my_struct{     int a; }; 

and memory layout of struct following:

class my_struct size(4):     +--- 0   |     +--- 

does mean c++ compiler consider struct same class @ everything? (expept default access specifier)

if that, how constructor , deconstructor of struct?

is there default constructor , deconstructor of struct? , similar class?

thanks supports,

in c++ notion of class defined following way

class-specifier:     class-head { member-specificationopt} 

where class-head in turn defined like

class-head:     class-key attribute-specifier-seqopt class-head-name class-virt-specifieropt base-clauseopt     class-key attribute-specifier-seqopt base-clauseopt 

where

class-key:     class     struct     union 

thus structure class class-key struct.

and (c++standard 12.1 constructors)

4 default constructor class x constructor of class x can called without argument. if there no user-declared constructor class x, constructor having no parameters implicitly declared defaulted (8.4). implicitly-declared default constructor inline public member of class...

as structure class , not have user-declared constructor such constructor declared implicitly compiler.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -