[ECOS] static member in class ???

Jonathan Larmour jlarmour@redhat.com
Wed Oct 10 06:07:00 GMT 2001


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



More information about the Ecos-discuss mailing list