In cases where you have a function that works for many different custom types with the same implementation, is it ok to use a design pattern like this?:
type1 implicitly casts to type0
type2 implicitly casts to type0
type3 implicitly casts to type0
Operate ( type0 )
and call:
type1 a
type2 b
type3 c
Operate ( a )
Operate ( b )
Operate ( c )
Are there any problems with this technique? Performance wise, clarity, etc?
EDIT: Also by implicit cast, I meant custom implemented casts for the type with no data loss, just convenience. Say you have a Pixel class, then sending an instance of this to a method that takes a Point2 automatically casts the pixel to a Point2.