How to : Static variable in inherited class

Posted by nXqd on Stack Overflow See other posts from Stack Overflow or by nXqd
Published on 2010-05-17T15:13:58Z Indexed on 2010/05/17 15:20 UTC
Read the original article Hit count: 144

Filed under:
class B {
 public:
   static int a;
}
class C:B {
}

I want to use a variable through any inherited classes but it has problem when I declare a.

B::B() {
  a=1;
}

Do I do it right ? Thanks for reading and waiting for your comments.

© Stack Overflow or respective owner

Related posts about c++