(Please quote your code with backticks).
In general, yes, this is the way to wrap some other object. In the specific example, I am not sure why you have a type parameter S
, you could just have T <: UnivariateDistribution
(perhaps you are using S
somewhere? but that is not in the example).
Also, there is no reason to restrict to Float64
, use some R <: Real
, so that your code would work with eg ForwardDiff.jl at zero performance cost.