CSE 5J Study Guide - Final Guide: Ellipse, Special Functions, Instance Variable

94 views26 pages
15 Sep 2018
School
Course
Professor

Document Summary

Void draw, void setup, functions, and system variables. Creating and using arrays and various array operations. Classes - user-defined data-type that will give the blueprint of how some object will. Data - the instance variables are the data belonging to the class. Procedures - the instance methods/functions are methods/functions belonging declared outside of our functions (ex. The class is similar to a blueprint and the object is the instance of the blueprint. To explain this in simpler terms, the class is like a cookie cutter and an object is like the cookie itself. size(200,200); Example 1: class and object void setup(){ void draw(){ Ball ball1 = new ball(); ball1. x = 150; ball1. y = 20; ball1. size = 50; ball1. display(); Ball ball2 = new ball(); //creates new ball object ball2. x = 30; ball2. y = 50; ball2. size = 100; ball2. display(); class ball{ int x; int y; int size; void display(){ Example 2: making a new object under a class.