mercredi 30 septembre 2020

how to implement scala decorator pattern ? How to make use of traits correctly? Is there a easier way?

example scenario have an object on which i need to perform operations at runtime namely multiply,add

trait sample{}
class ObjectToBeOperatedOn extends sample{}
class OperationDecorator extends sample{
 this: sample=>// Is using this correct
}
class AddOperation extends OperationDecorator{}

Aucun commentaire:

Enregistrer un commentaire