Tag: function
4 posts
-
C++ Name Hiding: Why a Derived Function Hides Base Overloads and How using Fixes It
Why a derived-class function hides every base-class overload with the same name, why the dangerous case compiles and silently calls the wrong function, and how using-declarations and -Woverloaded-virtual prevent it.
-
C++ Default Arguments: Rules, Virtual Function Traps, and API Design
How C++ default arguments work: trailing-only rules, header vs .cpp placement, call-site substitution, overload ambiguity, and the virtual function trap.
-
C++ return Statements: Copy Elision, Dangling Returns and Signaling Failure
How C++ return behaves: guaranteed elision vs NRVO, when return copies instead of moves, -Wreturn-local-addr, -Wreturn-type, and std::optional results.
-
C++ Function Overloading: Rules, Ambiguity, and Name
Why return type never disambiguates overloads, why float(10.0f) is not actually ambiguous between int and double, and how default arguments and const-qualified members interact with overload resolution.