[Development] Should QObject::event() be protected or public?

Jean-Michaël Celerier jeanmichael.celerier at gmail.com
Fri Mar 15 18:57:46 CET 2024


There's nothing more frustrating that instantiating a C++ type on the stack
like

     MyType foo;

and having to call a function with:

     static_cast<Base&>(foo).someVirtualMethod();

because "The base class is the interface" and all the
overriding methods are marked private.
This is just adding bureaucracy for absolutely no good reason and doesn't
help *anyone*.

On Fri, Mar 15, 2024 at 1:32 PM Christian Kandeler via Development <
development at qt-project.org> wrote:

> On 3/15/24 18:09, Marc Mutz via Development wrote:
> > I like simple rules. "Overrides should have the same access level as the
> > initial virtual function." is a simple rule.
>
> But it makes no sense in general. The base class is the interface, and
> overrides should have the least possible visibility for their purpose.
>
>
> Christian
>
> --
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240315/babc2812/attachment.htm>


More information about the Development mailing list