c++ - Accessing static members from 2 inherited class -


i have base class static queue:

class : public otherclass{ protected:     static queue queue[size];     static int front, rear; public:     void funca();     void funcb();  }; 

now 2 classes inherit class:

class b: public a{ public:      void funcc(); }  class c: public a{ public:      void funcd(); } 

my question is, when instantiate class b , c, there 1 instance of queue , both b , c pointing it, or there seperate instance b , c ?

the queue static -- there 1 instance of in whole program no matter how many subclasses or instances of create.

as far memory layout concerned, static member no different global variable declared outside class (save name mangling).


Comments