You may be stepping twice where once does nicely. `abstract Currency`
establishes Currency as an abstract type [in Julia, by convention, type
names are capitalized; it helps others to stay with that practice]. If we
want to use it `abstract Cash <: Currency` establishes Cash as
sub-abstractio
If you don't need the flexible interrelations provided by J. Sarnoff's
approach, you might use metaprogramming like this:
abstract Cash
function _validate(p::Cash)
p.b >= 100 && throw(ArgumentError("Too much..."))
(p.b < 0 || p.a < 0) && throw(ArgumentError("Cannot have negative
amount