This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: static member in class ???


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]