Static variable needs to be defined outside cpp class. inside the class we
dint difine it but just declared it.
So size to be considered is just 1 int variable.

On Wed, Jul 27, 2011 at 2:29 AM, Piyush Sinha <ecstasy.piy...@gmail.com>wrote:

> http://www.cprogramming.com/tutorial/size_of_class_object.html
>
> On 7/27/11, TUSHAR <tusharkanta.r...@gmail.com> wrote:
> > 1.
> > #include<iostream>
> > using namespace std;
> > class abc
> > {
> >         int x;
> >         static int y;
> > };
> > main()
> > {
> >             abc a;
> >             cout<<sizeof(a);
> >             cout<<sizeof(abc);
> > }
> >
> > why o/p is 4 4 ???????
> >
> >
> > 2.
> > class abc
> > { };
> > main()
> > {
> >           abc ob;
> >           cout<<sizeof(ob);
> > }
> >
> > why o/p is 1 ?
> > some say o/p may vary from os to os .....why ?? and what may be other
> > o/p s ?
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-7483122727*
> * <https://www.facebook.com/profile.php?id=100000655377926> "NEVER SAY
> NEVER"
> *
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Prashant Gupta
B.Tech Final Year
Computer Science and Engineering
NIT Trichy
Phone : +91 9894462744

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to