What role does void play in C++ class methods that print to file or screen?

  • Context: C/C++ 
  • Thread starter Thread starter spaghetti3451
  • Start date Start date
  • Tags Tags
    Type
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
spaghetti3451
Messages
1,311
Reaction score
31
Any method (within a C++ class) that prints to a file or to a screen has a return type of void. What role does the keyword void perform?
 
Physics news on Phys.org
failexam said:
Any method (within a C++ class) that prints to a file or to a screen has a return type of void. What role does the keyword void perform?
It indicates to the compiler that the method does not return a value.