I've been mainly programming PHP, and I recently started with C++.In PHP the return of a function can be of any type, so you can do checks like this:public function doSomething(){    if (! this->userHasAttribute()) {        return false;    }    return you are logged in.;}So basically, if the user would not be logged in doSomething would return false, else it returns a string.Since in C++ you return strictly one datatype, how would you approach this?How to structure those checks/policies, because clearly you dont want to have them inside a function itself (or you will be throwing exceptions everywhere you do a minor check).Please correct me if I said anything incorrect.I also came across this post, talking about why the Single Entry Single Exit notion exists in the first place. Someone said that the strongest argument in favor or SESE has vanished.https://softwareengineering.stackexchange.com/a/118717/269571
Return type declaration and checks
design patterns;object oriented;c++;architecture;php