icm class 4
Download
Skip this Video
Download Presentation
ICM class 4

Loading in 2 Seconds...

play fullscreen
1 / 22

ICM class 4 - PowerPoint PPT Presentation


  • 89 Views
  • Uploaded on

ICM class 4. Functions and Objects. Functions. Modularity. Functions. Modularity Reusability. Functions. Functions. ReturnType functionName (arguments){ } OutputType functionName (Input){ return output; }. Functions. int square(int number){ return number * number; }. Functions.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' ICM class 4' - vera-bray


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
icm class 4

ICM class 4

Functions and Objects

functions
Functions
  • Modularity
functions1
Functions
  • Modularity
  • Reusability
functions3
Functions

ReturnType functionName (arguments){

}

OutputType functionName (Input){

return output;

}

functions4
Functions

int square(int number){

return number * number;

}

functions5
Functions

Setup and draw… void

objects part 1
Objects – Part 1
  • Encapsulation
  • Modularity
encapsulation
Encapsulation
  • An object is a bundle of variables, statements and functions
encapsulation2
Encapsulation

class Car{

//declare properties

Car(){

//init properties

}

//declare more methods

}

encapsulation3
Encapsulation

Car car1;

void setup(){

car1 = new Car();

}

void draw(){

car1.doSomething();

}

encapsulation4
Encapsulation
  • Lets try it together
encapsulation5
Encapsulation

Makes it easy to have more than 1

encapsulation6
Encapsulation
  • Conceals the functional details
modularity
Modularity
  • Independent components
objects part 2
Objects – Part 2
  • Inheritance
  • Overloading
inheritance
Inheritance
  • Animals, cats and dogs… and elephants and giraffes, and goldfish!
inheritance1
Inheritance

class Animal{

Animal(){}

}

class Cat extends Animal {

Cat(){

super();

}

}

overloading
Overloading
  • Same function name + different arguments
  • Ie. fill(255);
  • fill(255,123,0);
  • fill(255,123,0,115);
why oop
Why OOP
  • Easier updating
  • Easier debugging
  • Easier sharing
  • Reusable maintainable code
why oop1
Why OOP
  • You don’t want to be like this guy
ad