Coffeehouse Post

Single Post Permalink

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

    Maddus Mattus said:
    Massif said:

    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);



    But there's a legit reason to do BaseClass b = DoWork();


    It's not that what you propose isn't technically possible by the compiler, it just breaks OOP. You don't want the compiler to break OOP do you?