Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Converting a handle to an access type

  • 18-06-2023 10:59pm
    #1
    Registered Users, Registered Users 2 Posts: 8,593 ✭✭✭


    Working in Ada95 - I'm passing a handle from packageA into packageB.Child.

    I'm calling (anonymised representation)

    packageB.Child.operation1(this => theDAta,
                              msg1 => theMsg1);
    

    I'm getting a compilation error in packageA because it is passing a handle into packageB.Child and packageB.Child is expecting (needing) an access type). It should be noted that theData is a local defined handle for packageB.

    error 1: expected an access type with designated private type "Object" define in packageB.Child.ads

    error 2: found type "Handle" defined at packageB.ads


    In packageB.Child I've defined the operation as:

    procedure operation1(this    : access Object;
                         msgData : Type_Name);
    


    PackageB.Child calls into the superclass (packageB):

    SuperClass.operation1(this    => SuperClass.Object(this.all)'Access,
                          msgData => msgData);
    


    My understanding is that as theData is a local it cannot be made into an access type. I don't want to pass the handle upwards into packageB as the number of sinks for theData means a large number of updates - and still doesn't resolve the fact that I need to switch from handle to access somewhere in the chain.

    How do I change the handle into an access type?


    I'm sure its simple enough, but I'm new to OOP and Ada doesn't have much of an online presence.



    TIA.



Comments

Advertisement