Please list real life examples of call by reference and call by value. Explaining the concept of a function, input parameters and output values can be a very difficult topic to teach. A good metaphor can help students understand the notion of parameters, call-by-reference and call-by-value. For example, think about the difference between identity theft and auto theft. If you look at your parking space and your car isn’t there, you know it has been stolen. You don’t have it any more. Yet, if someone steals your identity, you still have it. You can’t even tell it has been stolen until somebody else uses it. In some ways, auto theft is like call by reference because any changes the thief makes to your car, scratched paint, torn upholstery, etc., will still be there when you get it back.
Please list real life examples of call by reference and call by value. Explaining the concept of a function, input parameters and output values can be a very difficult topic to teach. A good metaphor can help students understand the notion of parameters, call-by-reference and call-by-value. For example, think about the difference between identity theft and auto theft. If you look at your parking space and your car isn’t there, you know it has been stolen. You don’t have it any more. Yet, if someone steals your identity, you still have it. You can’t even tell it has been stolen until somebody else uses it. In some ways, auto theft is like call by reference because any changes the thief makes to your car, scratched paint, torn upholstery, etc., will still be there when you get it back.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps