Introduction to Programming Discussion

profilekkaa

 

Answer this question after class, 

Respond to the posts of a couple of your classmates.

 

Week  Discussion

Sometimes, it's a good idea to use "pass by value," and leave the value of a variable unchanged.

Sometimes, it's a good idea to use "pass by reference," and have the called method change the value of a variable.

 

Can you think of an example of when "pass by reference" is a good idea? 

Please be very, very specific: Give the name of the variable, the name of the method, and the type of program.

 

Format: The variable <name of variable> could be modified by the method <name of method> in a <type of program> program.

 

Example: The variable "returnOnInvestement" could be modified by the method "CalculateProfitOrLoss" in a stock portfolio program.

    • 6 years ago
    • 5
    Answer(0)
    Bids(0)