+ 1
void function
Question-Write a function read_Product_Record which accepts a reference parameter new_Product of type product read_Product_Record fills new_new_Product with values entered from the keyboard. answer- void read_Product_Record(Product & new_Product) My question is how to you determine that you use âvoidâ..If i used âintâ..... will i be wrong? I undestand we use âvoidâ if they say there is no return value,other than that i dont understand in some places where they use it
2 Answers
+ 10
It looks like "void read_Product_Record(Product & new_Product)" is a friend function for Product class. But deciding whether you need to have a return type or not, is really depends on your program design.
For more info about friend function and it's usage see the following links.
[https://www.tutorialspoint.com/cplusplus/cpp_friend_functions.htm]
[https://www.programiz.com/cpp-programming/friend-function-class]
+ 1
Thanks for your input