今天看到一个面试题很有意思: namespace EventTest{ class Program { static void Main(string[] args) { A a = new C(); a.Show(); Console.ReadKey(); } } public class A { public virtual void Show() { Console.WriteLine("A"); } } public class B : A { public new virtu…
对于python装饰器结合递归的进一步理解 代码如下: import functools def memoize(fn): print('start memoize') known = dict() @functools.wraps(fn) def memoizer(*args): if args not in known: print('memorize %s'%args) # known[args] = fn(*args) for k in known.keys(): print('%s :…
主要目标是提供抽象能力和解决值类型的多态问题 Actually, Abrahams says, those are all attributes of types, and classes are just one way of implementing a type. Yet, they exact a heavy toll on programmers in that they may cause: Implicit sharing, such that if two objects ref…