Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRusttrait objects dyn vs genericsSingle-choice MCQ

You need a `Vec` that holds a mix of concrete types (some `Circle`, some `Square`) all implementing `Shape`, iterated and summed. Which statement about generics versus trait objects is correct?

trait Shape { fn area(&self) -> f64; }