De : Michael Stahl <mst@xxxxxxxxxxxxxxx>
Envoyé : mercredi 10 juillet 2019 11:25 À : Adrien Ollier; Tomaž Vajngerl Cc : libreoffice@xxxxxxxxxxxxxxxxxxxxx Objet : Re: tdf#74702 2/2 On 09.07.19 22:54, Adrien Ollier wrote:
> *De :* Michael Stahl <mst@xxxxxxxxxxxxxxx> > On 08.07.19 13:06, Tomaž Vajngerl wrote: >> >> Well IMHO the problem that you even have to think about this is that >> OutputDevice is a enormous class, and then you have to deal with another >> even more enormous subclass vcl::Window, which should never be a >> subclass of OutputDevice in the first place. However the work to change >> that is quite big and non-trivial. > > i rarely work with VCL's implementation so i can't really have an > informed opinion but if you say that delegation instead of inheritance > would be an improvement here i'm all for it. > > > Hello Michael, > > thank you for your answer. > Can you explain what delegation means for you? I don't understand what > you mean. you'd have to ask Tomaž who knows a lot more about OutputDevice, but my understanding is that instead of Window inheriting from OutputDevice he'd want Window to have a OutputDevice member, probably held by unique_ptr. > Also, I quite disagree with you. > First, C++ allows an overriding function to have a return type that is a > subclass of the return type of the overridden function. you can do that with covariance of course, but how would it help? is there a pre-existing class hierarchy somewhere that runs parallel to OutputDevice and its subclasses where this would fit in? it wouldn't help if you put it in OutputDevice itself, because then if you call the baseclass getter you get an OutputDevice*. ----------
Hi Michael,
I agree with you when you say that won't help. And I also agree when you say that my proposal is error-prone because it is easy to call the wrong function.
I am waiting for the validation of one change but in the future I am quite sure that every change will require a discussion for the best way to solve it.
Thank you very much for your help.
Regards,
Adrien Ollier
|
_______________________________________________ LibreOffice mailing list LibreOffice@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/libreoffice