If I do this with only the oppervlakte-trait it works like I expected. But when I add the inhoud trait, the compiler tells me about the oppervlakte trait “perhaps you need to add a supertrait for it”.
So I can imagine more or less what is wrong with my idea, but just to be sure: where did I go wrong in my thinking?
Please use English names in code. It's hard to tell what you are even trying to do.
If you are trying to cerate a blanket impl, then you need to implement the trait for a generic type. Traits are not types, so you can't implement a trait for a trait. You probably meant
You have a default implementation for the BerekenInhoud::inhoud method. Because this could be copy+pasted into any implementation, it needs to be valid for all possible implementations of the trait. Not every type is guaranteed to have an oppervlakte method, so the code is invalid.
When thinking about whether generic code is valid or not, remember that the compiler doesn't consider how the code is used/which specific types the trait is implemented for. The compiler checks validity entirely based on the interface you've specified, and any type constraints you've specified. That you've only ever implemented BerekenInhoud for the Vierkant type (which also has a BerekenOppervlakte implementation) is irrelevant.
Edit: another way to look at it: nowhere in the definition of BerekenInhoud or the inhoud method did you specify that an oppervlakte method must exist. It might, but you didn't require it.
You seem to be fundamentally confused about the notation here. impl does not denote a method in itself. I suggest you study the syntax first to be able to ask meaningful questions.
The trait boundType: Trait specifies the constraint that Type must implement Trait. It does not restrict to a set of concrete types. It doesn't have anything to do with methods.
Regarding the english translation: it is way better to use correct native words than wrong translations. While "content" isn't the translation of "inhoud" (it is "volume") it isn't misleading, but "surface" is the "oppervlakte" of all 6 sides of the rectangular cuboid summed. The correct translation of "oppervlakte" is "area". Please, @Abmvk do not take that as criticism of your translation, but, please @H2CO3 do not force people to actually make their code "wrong" for readers.
One way to get to the correct term (as long as it's a "simple" mathematical one, as usage of others may differ) is using Wikipedia - Oppervlakte and the button for "other language", which leads to Wikipedia -Area.
Because I saw the thread about the usage of traits: this (mathematics) is a case where you do not want to use a type class hierarchy (sorry, trait hierarchy). But this is another discussion.
I am not forcing anyone to be wrong. This is an English language forum. It is 100% the asker's responsibility to ask a correct question if they expect a useful answer. I do not believe that those who already offer their time and effort to answer should additionally bear the burden of translating (and potentially mistranslating) from another language.
Speaking as someone who only speaks English: literally nothing about this question requires understanding the names. They may as well be Foo Bar Baz.
That said, there are plenty of times when it makes sense to ask clarifying questions to be able to better help the asker, but most of the time you should also put in a good effort to answer anyway.
Yes, strictly speaking, it's not a requirement. It's just syntax. But chewing through a bunch of unfamiliar words is just unnecessary cognitive load, and that is a very real effect.
I do understand it is easier to understand the question when in English, and I honestly slapped myself for not thinking of area and volume. I very much respect and enjoy the great help this forum offers. I don’t feel insulted or forced in any way, I appreciate the comments about using English.