Y
ypjofficial
Hi all,
In what way does the enumerated data type contibute to the size of a
class if its part of that class?
eg.
#include <iostream.h>
class one
{
public:
enum months{jan =1,feb =2};//till dec = 12
};
int main()
{
cout<<sizeof(one);//outputs 1
cout<<sizeof(one::months);//outputs 4
}
so why the size of enumerated datatype months doesn't get contributed
to the size of the one class?
Thanks and Regards,
Yogesh Joshi
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
In what way does the enumerated data type contibute to the size of a
class if its part of that class?
eg.
#include <iostream.h>
class one
{
public:
enum months{jan =1,feb =2};//till dec = 12
};
int main()
{
cout<<sizeof(one);//outputs 1
cout<<sizeof(one::months);//outputs 4
}
so why the size of enumerated datatype months doesn't get contributed
to the size of the one class?
Thanks and Regards,
Yogesh Joshi
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]