How to change Default Classes 'Game Viewport Client Class' in C++ code?

How to change Default Classes ‘Game Viewport Client Class’ in C++ code?

I know I can change through Edit → Project Settings → Engine → General Settings → Default Classes → Game Viewport Client Class.

But I want to change TSubclassOf UEngine::GameViewportClientClass in C++ code.

Where and how can I do that?

  1. File → New C++ Class…
  2. Check the ‘Show All Classes’ checkbox to provide the search interface of everything that inherits from Object.
  3. Search for GameViewportClient.
  4. Click ‘Next >’

From there you can set it up where you like, etc.