Files
sunny9898/task8/_ref/noc-examples-processing-master/chp04_systems/simpleInheritance/simpleInheritance.pde
louiscklaw 5637fbf94f update,
2025-02-01 02:07:58 +08:00

26 lines
559 B
Plaintext

// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
// 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);
// 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();
}