Search:

Type: Posts; User: GregBrannon

Search: Search took 0.12 seconds.

  1. Replies
    9
    Views
    1,353

    Re: I have a problem with class inheritance.

    Perfect. Glad to help.
  2. Replies
    9
    Views
    1,353

    Re: I have a problem with class inheritance.

    Instead of returning Animal.numberOfLegs, try:

    return numberOfLegs;

    As for removing the word 'static' everywhere, I'm all for it, but I hadn't analyzed what problems that may cause. Let us...
  3. Replies
    9
    Views
    1,353

    Re: I have a problem with class inheritance.

    No, I didn't say that. I said that the specific variable, numberOfLegs in the class Animal should not be static. Static nested classes is an entirely different subject, related to this topic only...
  4. Replies
    9
    Views
    1,353

    Re: I have a problem with class inheritance.

    This in Animal:

    public static int numberOfLegs;

    should not be static. Making it static means that all subclasses "share" the variable numberOfLegs. This is also called a "class variable,"...
Results 1 to 4 of 4