Skip to content

Overriding SocketReactor::run() is not reasonably possible #4556

Closed
@ostkamp

Description

@ostkamp

SocketReactor has a virtual run() method, see

virtual void run();

If it gets overridden by a run() method in a child class for extending its functionality, this child method has zero access to the required data of the base class (e.g. params provided to constructor, data added later through method calls etc.), since that data is completely private in base class. This also applies to several methods used in the original code of run() in the base class.

It is thus not possible to extend the functionality of the base class run() method.

To Reproduce
Create a child class inheriting from SocketReactor and add a run() method which overrides. Try to copy in the code from original run() method of the base class. It won´t compile because of accessing private members and methods. Try to instantiate an object just to ensure compilation is attempted.

Expected behavior
The currently private data of the base class SocketReactor should become protected so it can be accessed from overridden run() method in child class. This also applies to private methods used by the original run() method of the base class. Steps outlined in "To reproduce" should compile, link and work ok.

Logs
N/A

Screenshots
N/A

Please add relevant environment information:

  • Linux
  • Checked with POCO Version 1.13.3, most likely was in already earlier

Additional context
N/A

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions