3 ms·
> which makes no sense, because this is the same code as you had. My suspicion is that there's something magic about declaring classes in packages? Yeah. Disp
by msbarnett 11y ago
> which makes no sense, because this is the same code as you had. My suspicion is that there's something magic about declaring classes in packages?
Yeah.
Dispatching methods on a type consist of the type's "primitive operations". The Ada 95 Rationale spells it out: "Just as in Ada 83, derived types inherit the operations which "belong" to the parent type - these are called primitive operations in Ada 95. User-written subprograms are classed as primitive operations if they are declared in the same package specification as the type and have the type as parameter or result."
It seems like a wart that you're not in an "anonymous" package in situations like your example, but I also guess it probably doesn't come up much in "real" programs.