Hi,
While I was reading the topic - Chain of responsibility pattern, I found
one
example(Chain-of-responsibility pattern - Wikipedia),
which I’m trying to write in
Ruby. This is a part of the example given there.
abstract class PurchasePower {
protected static final double BASE = 500;
protected PurchasePower successor;
public void setSuccessor(PurchasePower successor) {
this.successor = successor;
}
abstract public void processRequest(PurchaseRequest request);
}
But, while writing code in Ruby to convert the above, I got confused
when I
saw the protected static final double BASE = 500;
. Now, as In Ruby no
such
method called protected_constant exist, what else way I should write it?
Why in Ruby protected_constant doesn’t exist, but private constant and
public_constant does ?
–
Regards,
Arup R.
Debugging is twice as hard as writing the code in the first place.
Therefore,
if you write the code as cleverly as possible, you are, by definition,
not
smart enough to debug it.
–Brian Kernighan