I understand. it is stupid one. thanks
dragon_yue
Posts
-
a puzzle for timing method -
a puzzle for timing methodits not homework, I konw its simple. thanks your answer. do you think the new class inherit from interface or that class. which one is better
-
a puzzle for timing methodpublic interface IncDec { void Increment(); void Decrement(); } public class MyIncDec : IncDec { private int x; public MyIncDec(int x) { this.x = x; } public void Increment() { this.x++; } public void Decrement() { this.x--; } }
Part 1: Implement a class which can be used to measure how long each invocation of the Increment and Decrement method takes (in milliseconds) and prints out this information. The class should fit in more or less transparently with existing clients of the IncDec interface. Part 2: Imagine you need to do something similar (timing of method calls) for many places in an application. What other ideas come to mind, e.g. could you propose other ideas for getting timing information more conveniently? I got this question need to answer, it is simple, just something confused to me. hope anyone can help me. btw, what "The class should fit in more or less transparently with existing clients of the IncDec interface. " means?