RAD Studio |  |

W8052: Base initialization without a class name is now obsolete (C++)

(Command-line option to suppress warning: -w-obi)

Early versions of C++ provided for initialization of a base class by following the constructor header with just the base class constructor parameter list.

It is now recommended to include the base class name.

This makes the code much clearer, and is required when you have multiple base classes.

Old way

Copy Code

    derived::derived(int i) : (i, 10) { ... }

New way

Copy Code

    derived::derived(int i) : base(i, 10) { ... }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!