In Scala, every package permits one package object to declare. It is a singleton object where the defined members can be imported in a class through the package import. It lets the developer define top-level functions. Please note that overloading is not allowed in package objects. Let’s see an example:
package object myconverters {
def fromAtoB (a:A): B = ... //conversion logic def fromAToInt (a:A):Int = ... //conversion logic
different other converters
}