| delorie.com/archives/browse.cgi | search |
| From: | leoxii AT my-dejanews DOT com |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Help |
| Date: | Tue, 27 Apr 1999 15:15:40 GMT |
| Organization: | Deja News - The Leader in Internet Discussion |
| Lines: | 61 |
| Message-ID: | <7g4kam$sj6$1@nnrp1.dejanews.com> |
| References: | <JJDHMNOMDDBJAAAA AT zdnetmail DOT com> <37252B2E DOT 2C928964 AT unb DOT ca> |
| NNTP-Posting-Host: | 208.193.202.20 |
| X-Article-Creation-Date: | Tue Apr 27 15:15:40 1999 GMT |
| X-Http-User-Agent: | Mozilla/4.0 (compatible; MSIE 4.01; Windows 95) via proxy gateway CERN-HTTPD/3.0 libwww/2.17 |
| X-Http-Proxy: | 1.0 B000061, 1.0 x10.dejanews.com:80 (Squid/1.1.22) for client 208.193.202.20 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
In article <37252B2E DOT 2C928964 AT unb DOT ca>,
Endlisnis <s257m AT unb DOT ca> wrote:
> Paul A Jimenez wrote:
>
> > I don't know if this is a complier bug or just a mistake that I am not
catching.
> >
------------------------------------------------------------------------------
> > #include <iostream.h>
> > #include <conio.h>
> >
> > class stack
> > {
> > public:
> > static int stack_count ;
> > public:
> >
> > static int get_count(void)
> > {
> > return(stack_count);
> > }
> > stack()
> > {
> > ++stack_count;
> > }
> > };
>
> int stack::stack_count;
> //It needs to set aside space for the variable.
>
> > main()
> > {
> > stack a_stack;
> > stack b_stack;
> > stack c_stack;
> >
> > clrscr();
> >
> >cout << stack::get_count;
// should be as follows
cout << stack::get_count();
> > }
>
> That compiles and runs, but it output's "1" when I run it. I would have
expected it to output "3". Can anyone explain it?
>
> --
> (\/) Endlisnis (\/)
> s257m AT unb DOT ca
> Endlisnis AT BrunNet DOT Net
> Endlisnis AT HotMail DOT com
> ICQ: 32959047
>
> (Once upon a time there was light in my life)
> (But now there's only _______________ ???)
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |