topical media & game development

talk show tell print

graphic-processing-learning-22-example-22-1-example-22-1.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 22-1: Inheritance
  
  // Object oriented programming allows us to defi ne classes in terms of other classes.
  // A class can be a subclass (aka " child " ) of a super class (aka "parent").
  // This is a simple example demonstrating this concept, known as "inheritance."
  Square s;
  Circle c;
  
  void setup() {
    size(200,200);
    smooth();
    // A square and circle
    s = new Square(75,75,10);
    c = new Circle(125,125,20,color(175));
  }
  
  void draw() {
    background(255);
    c.jiggle();
    s.jiggle();
    c.display();
    s.display();
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.