Suppose I have a class called AudioSample
, the implementation is not relevant. AudioSamples can be downloaded from several sources, for each source I get a class from AudioSample, which adds the appropriate loader code for this source. After loading, I slice the object on purpose, passing it to a function that uses AudioSample
by value.
It seems to me that this prevents the base class from becoming contaminated by various loading functions and prevents me from modifying the (tested and verified) base class when adding a new bootloader.
However, when I search for stackoverflow to trim objects, I find answers that describe this as a problem and explain it with potential traps, and this makes me wonder: am I using it the way I shouldn't? Will I encounter potential problems doing this I do not currently know?
source
share