Create Object Instances
Class Definition
Create Objects: Reference-Type Variable
Button myButton = new Button(); //create reference variable and call constructor Button myButtonPointer = myButton; // 2 Button reference variables are both `referring` to a single Button object instance.//create function that takes an object as input parameter void myFunction( Button localButton ){ localButton.x = 100; } Button myButton = new Button(); myButton.x = 5; myFunction( myButton ); println(myButton.x); ///myButton.x is now 100, it was modified in the function
Last updated