Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple inheritance and C#
    primarykey
    data
    text
    <p>Let's say I have two base abstract classes with completely different functionality: Laptop and Smartphone. (Suppose the functionality is completely different). And in my current project I had already many implementations of laptops and smartphones, and they always were completely different.</p> <p>But suddenly I received a request to add a class that is an implementation of pc-tablet, that is actually have functions of both smartphone and laptop. It is too late to change the base classes, and actually I'm very sure that this pc-tablet will appear only once.</p> <p>The problem is, I should be able to contain my pc-tablet in the conainer for smartphones, but it should also be laptop, because of the inherited functionality (actually beside that, in some part of the project pc-tablet is used only as laptop, and it doesn't need smartphone functionality. Moreover it is bad to look at pc-tablet as smartphone for that particular part of the project). So I have PcTabletAsLaptop : Laptop class, that is actually a laptop, and not a smartphone.</p> <p>My solution is to add a wrapper:</p> <pre><code>class PcTablet : SmartPhone { private PcTabletAsLaptop _pcTablet; // Here goes all the methods of PcTabletAsLaptop as proxies: public void Call(int number) { _pcTablet.Call(number); } // ..... } </code></pre> <p>There are 200+ methods and I want them to be generated automatically from PcTabletAsLaptop.</p> <p>This solution looks quite complicated. My question is it good, or maybe there are some simplier ways to do that?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload