I think you are looking for interfaces/traits. Unfortunately this is currently not provided by the julia language itself, but if you google for it, you can find various ways to work around it. See for example How to find if a method is implemented for an interface? or https://github.com/mauro3/SimpleTraits.jl.
See also Interfaces for Abstract Types · Issue #6975 · JuliaLang/julia · GitHub.