static classvariable

Discussion in 'C++' started by Nils, Nov 9, 2003.

  1. Nils

    Nils Guest

    Hi,
    I have derived a class B from A. In both classes I have declared a static
    variable with the same name. Do they both exists, or only the one in
    Fatherclass A.
    For Example:
    class A{
    static int a;};
    class B:A{
    static int a;};

    Thank you for your Help!!
     
    Nils, Nov 9, 2003
    #1
    1. Advertising

  2. "Nils" <> wrote...
    > I have derived a class B from A. In both classes I have declared a static
    > variable with the same name. Do they both exists, or only the one in
    > Fatherclass A.


    Both.

    > For Example:
    > class A{
    > static int a;};
    > class B:A{
    > static int a;};
     
    Victor Bazarov, Nov 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Natan

    Static vs. non-static connection

    Natan, May 24, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    7,335
    Sami Vaaraniemi
    May 26, 2004
  2. Ben
    Replies:
    3
    Views:
    422
  3. Paul W

    Static is REALLY Static!

    Paul W, May 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    376
  4. =?ISO-8859-1?Q?Thomas_Gagn=E9?=

    Why do static and non-static method names collide?

    =?ISO-8859-1?Q?Thomas_Gagn=E9?=, Jul 2, 2003, in forum: Java
    Replies:
    12
    Views:
    5,652
    cgbusch
    Jul 5, 2003
  5. natG
    Replies:
    8
    Views:
    808
    Roedy Green
    Sep 23, 2003
Loading...

Share This Page