Search code examples
oopadagnat-gps

object.method notation in Ada


does anyone know of a good resource to explain when the object.method notation can be used in ada?

for example:

person.walk(10);

I've been doing a bit of googling and haven't figured it out yet. Does it only apply to tagged records?

I use GPS as my Ada IDE, I quite like being able to go bla.<type something> and getting suggested methods to call.

I'm a bit confused also on why the dot notation can't be used for anything where the first parameter matches the type in question.

Thanks

Matt


Solution

  • Yes, it only applies to tagged record (the vtable is used to find the corresponding method). It can be used for all primitive operations, or for the 'Class operations defined in the same package. One of the nice benefits of the notation is that you do not need a "with" on the package that defines the type. We tend to use tagged types more often theses days, just so that we can use the dot notation indeed.