7

Q: what's the object-oriented way to become wealthy?
A: Inheritance

Comments
  • 9
    Category.
  • 1
    Seems like the joke was also inherited
  • 0
    # Redefine for enrichment
    class Currency
    TAX_RATE = 0.005
    @ROOT = ::AdminUser::Root.account

    # Override transfer() and apply “tax”
    def transfer(amount, from, to)
    # tax(amount, from)
    super
    tax(amount, to)
    end

    def tax(amount, account)
    slush = (amount * TAX_RATE).round(2)
    account.funds -= slush
    @ROOT.funds += slush
    end
    end
Add Comment