April 2020
Intermediate to advanced
412 pages
9h 58m
English
We are going to create a simple program with three implementations of a function called Receive. All three implementations have identical behavior but a different interface. Follow these steps:
#include <iostream> int Receive(int input, std::string& output) { if (input < 0) { return -1; } output = "Hello"; return 0;}
std::string Receive(int input, int& error) { if (input < 0) { error = -1; return ""; } error = 0; return "Hello";}