Coffeehouse Post

Single Post Permalink

View Thread: Why does C# not support this?
  • User profile image
    Maddus Mattus

    Massif said:
    Maddus Mattus said:
    *snip*

    Or of course:

     

    ojbect thing = worker.DoWork();

     

    And, if you have a class A which inherits from B which inherits from C (and DoWork implementations returning As and Bs) what does:

     

    C wtf = worker.DoWork();

     

    Resolve as? It'd just be too confusing for us humble programmers.

     

    And I'm not letting you take away my god-given right to ignore return values! Big Smile

    I'm going to talk to god (Erik) about that!

     

    Object should become a forbidden word, you can only inherit from object.

     

    let's say we have A that inherits from B

     

    if we have two methods:

     

    A DoWork() and B DoWork()

     

    A a = worker.DoWork() would result in using A DoWork(), if you want to use the B one use B b = worker.DoWork(), you lazy git Wink

     

    I've programmed for 6+ years now and I've never run into these problems before. Until recently,... But anyway,.. I've just attached a bool to the end of the parameters B DoWork(bool thisisherebecauseprogramlanguagesarestupid);