title: Should I use a superclass' setters to initialise its instance variables from a subclass?
body: <p>I have a superclass 'Vehicle' and its subclass 'Car' as shown below. I want to initialise the variable 'wheels' from the constructor of the subclass Car. I can not set the variable via the super() call as it relies on a call to a method. </p>
  
  <p>Is it safe to use the superclass' setter method here?
  If not is there a problem with the OO fundamentals of the relationship between the classes?</p>
  
  <p>ps. try to excuse the clumsy vehicle/car/chassis example and assume that the method call 'findNumberOfWheels' outside of the constructor is necessary.</p>
  
  <p>Vehicle Class</p>
  
  <pre><code>public abstract class Vehicle {
  
      private int wheels;
      private Chassis chassis;
  
      public Vehicle(Chassis chassis){
         this.chassis = chassis;
      }
  
      public int getWheels() {
         return wheels;
      }
  
      public void setWheels(int wheels) {
         this.wheels = wheels;
      }
  
      public Chassis getChassis() {
         return chassis;
      }
  
      public void setChassis(Chassis chassis) {
         this.chassis = chassis;
      }
  
  }
  </code></pre>
  
  <p>Car Class</p>
  
  <pre><code>public class Car extends Vehicle{
  
      public Car(Chassis chassis) {
          super(chassis);
          setWheels(findNumberofWheels(chassis));
      }
  
      private int findNumberofWheels(Chassis chassis){
          return chassis.getWheels();
      }
  
  }
  </code></pre>