Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm exam 2 review Spring2007: Understanding inheritance

Back to Midterm Exam 2 Review-Spring 2007

Questions? Answers? Comments?


public class DrawableNode extends LLNode{
  public DrawableNode next;

  /*Constructors*/
  public DrawableNode() {
    next = null;
  }

  /*Methods*/
  public void setNext(DrawableNode nextOne) {
   super //this.next = nextOne;
  }

  public Drawable getNext() {
   super// Return this.next;
  }

  public void remove(DrawableNode node) {
   super /*Assume working code*/

  public void insertAfter(DrawableNode node) {
    super/*Assume working code*/
  }
}// end of DrawableNode class

so for this question we just start by extending the subclass(in this case drawable node) with the superclass. and if a method is found in the superclass(LLNode) we just say super. is that correct or do we just take those off..bit confused :$

public class DrawableNode extends LLNode {
   public DrawableNode next;
   public DrawableNode();
   super();

public class DrawableNode extends LLNode {
  public DrawableNode next;

  /*Constructors*/
  public DrawableNode() {
   super();
    next = null;
  }
}</codE><br>is this correct?|
- Nope. *Dawn Finney*.
_
|<code>public  class DrawableNode extends LLNode{
   public DrawableNode next;
   public DrawableNode(){
     next = null;
   }
}

public class DrawableNode extends LLNode {
  public DrawableNode next;

  /*Constructors*/
  public DrawableNode() {
    super();
  }
}
///We can delete everything from the parent class LLNode and this would be our remaining code, correct?

public class DrawableNode extend LLNode{}
Is this all you would need since in this version every part of DrawableNode is already handled by LLNode?

public class DrawableNode extends LLNode {
  public DrawableNode next;

  /*Constructors*/
  public DrawableNode() {
    super();
      }
}

Is it correct or do we have to do more manupulations to this?

public class DrawableNode extends LLNode {
   public DrawableNode next;
   /*Constructors*/
   public DrawableNode() {
      next = null;
      super();
   }
}

public class DrawableNode extends LLNode {
   /*Constructors*/
   public DrawableNode() {
      super();
   }
}

public class DrawableNode extends LLNode {
   public DrawableNode next;
   /*Constructors*/
    super();
   public DrawableNode() {
      
         }
}
Is this correct?

public class DrawableNode extends LLNode {
  public DrawableNode next;
 
public DrawableNode() {
    next = null;
  
/*Constructors*/
  public DrawableNode() {
    super();
  }
}
i think this might be right...

The default constructor of any class is to call super(), although it is always a good idea to write this method out because if you ever create a constructor, it wont call super unless you tell it to. See this site if you're still not understanding constructors.Brian O'Connor.




Link to this Page