Page 1 of 1

broader vs wider range of subclass

Posted: Thu Mar 01, 2018 3:50 pm
by hsiaok
Does "broader" class means subclass or superclass of the class in question ?
Does "wider" means the opposite of broader ?

very confusing to me.
Please verify.
Thanks.

Re: broader vs wider range of subclass

Posted: Thu Mar 01, 2018 9:44 pm
by admin
"broader" and "wider" both mean the same thing i.e. something that covers more. "narrow" is the opposite of "broader".

In general, a subclass is "narrower" than a superclass because it is more specific. For example, an IOException is narrower than Exception because an Exception will cover a lot more number of classes than an IOException. In other words, every IOException is an Exception but every Exception is not an IOException because there can be a class that is an Exception but not an IOException. Thus, Exception covers more exceptions than IOException.

When talking about range, broader or wider do not necessarily always mean subclass or super class. For example, if a method in super class throws an exception named A, the overriding method in a subclass cannot throw exceptions A and B because an overriding method cannot throw a wider range of exceptions than the overridden method.