CSE 8A Lecture Notes - Lecture 4: Function Overloading

38 views1 pages

Document Summary

Lecture notes: this refers to object that calls the method: is very general, replaced by object that calls it. Giving method parameters: declare parameter when creating method public void drawsquare (int width) , when you call the method, you input an argument into the () turtle. drawsquare(50); The 50 becomes the value for the width variable. Therefore, the variable"s name can now be used later on in the method"s body: this. forward(width), methods with parameters are different, even though they have the same name. Called method overloading: make methods more general, specify the information you put into methods. Writing methods: avoids copy and pasting code, avoids fixing bugs in more than one place, makes it easier to read.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions