# I need some help defining an interface that would kind of be a static class method

**URL:** <https://discourse.julialang.org/t/i-need-some-help-defining-an-interface-that-would-kind-of-be-a-static-class-method/54883>\
**Category:** General Usage\
**Created:** [February 9, 2021, 12:20am UTC](https://discourse.julialang.org/t/i-need-some-help-defining-an-interface-that-would-kind-of-be-a-static-class-method/54883 "2021-02-09T00:20:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [February 9, 2021, 12:20am UTC](https://discourse.julialang.org/t/i-need-some-help-defining-an-interface-that-would-kind-of-be-a-static-class-method/54883/1 "2021-02-09T00:20:49Z")

</div>

I need some help defining an interface that would kind of be a static class method in an OO language (while also having concrete instances of the contextual class with functionality in the class methods). For simplicity, let’s say I have a method, some context-defining types like `Parabola` or `Line` and a function like `evaluate` where I want to define evaluate with something like this `evaluate(Parabola, coefs::Vector{Number}, x::Number}) = coefs[1] * x^2 + coefs[2] * x + coefs[3]` and `evaluate(Line, coefs::Vector{Number}, x::Number) = coefs[1] * x + coefs[2]`. I know this can easily be solved in this particular case another way, but it’s just an example of the behavior.

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1612830028310400?thread_ts=1612830028.310400&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![JHonaker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jhonaker/32/18558_2.png) [@JHonaker](https://discourse.julialang.org/u/JHonaker)\
**Post date:** [February 16, 2021, 4:18pm UTC](https://discourse.julialang.org/t/i-need-some-help-defining-an-interface-that-would-kind-of-be-a-static-class-method/54883/2 "2021-02-16T16:18:37Z")

</div>

Unsurprisingly, this is definitely supported. It was pointed out to me that this is exactly how the fitting procedures in `Distributions.jl` work.

The needed function signature would be something like:

```julia
evaluate(::Type{Parabola}, coefs::Vector{<:Number}, x::Number) = ...

# or 

evaluate(::Type{Line}, coefs::Vector{<:Number}, x::Number) = ...

```
