Does Scala have a way to override methods from that are called from different class objects?

Thanks for your reply @sangamon , and sorry for my late one.

Yeah, tell me about it…

The exact exercise text is this:

Implement the configurable collection using runtime parameters in the file runtime/Collection.scala. We provide the collection interface and a configuration class that gets passed to the constructor of the collection class. Your implementation must change its behavior based on the values in the configuration object.

I knew about the pattern match by type, but the thing is, the match variable should be a parameter of method pop() leading to pop(match: SelectDataStructure), and it is stated that we can’t modify the tests.

I also tried a naive if else block: if(config == LIFO) after FIFO implementation, which doesn’t even pass the 1st test. When I add only FIFO code the 1st test is passed.

I tried to read RunDataStructure as a string and compare it with “LIFO”, but its value is the memory location of the instantiated object.

It is a fairly simple exercise but I can’t think of anything I know of to make it work.