OOP vs macro problem

前端 未结 7 1212

I came across this problem via a colleague today. He had a design for a front end system which goes like this:

class LWindow
{
   //Interface for common meth         


        
7条回答
  •  清酒与你
    2021-01-04 13:04

    Does'nt answer your question directly may be, but can't help from telling you to Read up on the Bridge Design pattern in GOF. It's meant exactly for that.

    Decouple an abstraction from its implementation so that the two can vary independently.

    From what I can understand, you are already on the right path, other than the MACRO stuff.

    My reaction was to pass an LWindow*(Implementation object) to the base LWindow class so it can do this:

提交回复
热议问题