title: passing attributes of superclass to subclass
body: <p>I have Employee, manager class.</p>
  
  <p>employee has private String name, int age, double salary. they have to be placed in one method. i placed them in String details </p>
  
  <pre><code>public void details(String name,int age, double salary)
  {
      this.name=name;
      this.age=age;
      this.salary=salary;
    }
  </code></pre>
  
  <p>then they have to be passed down to class manager but theres a new attribute to be added, which is department.</p>
  
  <pre><code>class Manager extends Employee{
      private string department;
  }
  </code></pre>
  
  <p>thats my problem, i cant output the attributes together with the attribute department. </p>
  
  <hr>
  
  <p><strong>UPDATE #1</strong></p>
  
  <p>I've tried using this code before:</p>
  
  <pre><code>public void details(String name, int age, double salary, String dept) 
  {
     super(name, age, salary);
     this.dept = dept;
  }
  </code></pre>
  
  <p>But it gives me error that the call to super must be first statement in constructor.</p>
  
  <p>this is how my manager extends employee class looks like.</p>
  
  <pre><code>class Manager extends Employee 
  {
      private String department;
      public Manager(String name,int age,double salary,String department)
      {
          super(name,age,salary);
          this.department=department;
       }
  
       public String getDetails()
       {
           return super.details;
       }
  
       public void details(String name, int age, double salary, String department) 
       {
           super(name, age, salary);
           this.department = department;
       }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE #2</strong></p>
  
  <p>The attributes name, age and salary has to be private. I've tried changing it to public and use <code>super.details(name age salary)</code> and it worked. I've tried the same codes but with private attribute but it didn't work .</p>