Decorator pattern implementation

前端 未结 3 851
情话喂你
情话喂你 2020-12-28 19:15

Trying to implement the decorator pattern in C# from the code in the \"Head First Design Patterns\" book (written in Java).

I am just starting out with C# and am the

3条回答
  •  孤独总比滥情好
    2020-12-28 19:56

    You have declared the Cost() method of Mocha as new instead of override. See here the difference: http://blogs.msdn.com/b/csharpfaq/archive/2004/03/12/what-s-the-difference-between-code-override-code-and-code-new-code.aspx

提交回复
热议问题