Split 1 large C++ classes into multiple classes, whilst still using original classes member syntax

  arduino-c++, c++, refactoring, wrapper

So I’m currently working on a project refactoring an Arduino library, using the vs plugin vMicro.

The library itself had various large groups of methods like "NXG_Rover_Sounds" and "NXG_Rover_MotorCtrl" which I’ve decided to separate into there own classes, all with the appropriate #includes, friending, class method refrences and static…izing.

The code itself looks nice and compiles fine, but my boss wants to be able to call all the methods by their original (or at least just one) syntax, like they were all members of the same class back when they were in "NXG_Rover".

Like if I created an object rover, to use rover.playSound(), instead of NXG_Sound::playSound()

He threw around the term "Wrapper class", or "Wrapper Functions".
So I did a bit of digging, and the best documentation I could find, I’m kinda struggling to wrap my head around: https://stroustrup.com/wrapper.pdf

Can anyone out there explain how it would work / the appropriate syntax involved?
Is there an easier option?

Source: Windows Questions C++

LEAVE A COMMENT