void function | SoloLearn: Learn to code for FREE!


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

10/4/2017 3:41:32 PM


2 Answers

New Answer


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]


Thanks for your input