--- title: C26434 description: "Microsoft C++ Code Analysis warning C26434 for the C++ Core Guidelines case C.128." ms.date: 08/21/2020 ms.topic: "conceptual" f1_keywords: ["C26434"] helpviewer_keywords: ["C26434"] ms.assetid: 7f66477f-da66-444a-a6e3-44513d7d7e31 --- # C26434 DONT_HIDE_METHODS > `Function 'derived::function' hides a non-virtual function 'base::function' (c.128).` ## C++ Core Guidelines [C.128: Virtual functions should specify exactly one of virtual, override, or final](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) ## Remarks When you introduce a function that has the same name as a non-virtual function in a base class, you may get unexpected behavior. It's like introducing a variable name which conflicts with a name from an outer scope. For example, you may have intended to override a base class function. If the signatures of the functions don't match, the override you intended may turn into an overload instead. In general, name hiding is dangerous and error-prone. In the Core Guidelines checks: - Only non-overriding functions in the current class are checked. - Only non-virtual functions of base classes are considered. - No signature matching is performed. Warnings are emitted if unqualified names match. ## Example This example demonstrates how a derived class can hide non-virtual functions, and how virtual functions allow both overloads and overrides: ```cpp // C26434.cpp struct Base { virtual ~Base() = default; virtual void is_virtual() noexcept {} void not_virtual() noexcept {} }; struct Derived : Base { void is_virtual() noexcept override {} // Okay, override existing function virtual void is_virtual(int i) noexcept {} // Add a virtual overload for function void not_virtual() noexcept {} // C26434, hides a non-virtual function virtual void not_virtual(int i) noexcept {} // C26434, and parameters ignored }; ```