This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: static member in class ???
- To: Tony Ko <nhko at gctsemi dot com>
- Subject: Re: [ECOS] static member in class ???
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Wed, 10 Oct 2001 14:09:04 +0100
- Cc: ecos-discuss at sources dot redhat dot com
- References: <0F61D7853F0B434A90567901F0D604EF07CB3F@gctsemi.gctsemi.com>
Tony Ko wrote:
>
> hi.
> look at "Cyg_Scheduler" class below.
>
> class Cyg_Scheduler
> : public Cyg_Scheduler_Implementation
> {
> .
> .
> .
> public:
> .
> .
> // The only scheduler instance should be this one...
> static Cyg_Scheduler scheduler;
> };
>
> scheduler object is referenced as a static member.
> then why must this be referenced as a static member???
I'm not sure exactly what you're asking but a static data member in a C++
class is "shared" between all instances of that class. Or you can even do
Cyg_Scheduler::scheduler. It's just C++.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine