Private area and child packages
danmcleran_at_hotmail.com
Date: 12/29/04
- Next message: Jeffrey Carter: "Re: Converting"
- Previous message: Nick Roberts: "Re: Converting"
- Next in thread: tmoran_at_acm.org: "Re: Private area and child packages"
- Reply: tmoran_at_acm.org: "Re: Private area and child packages"
- Reply: Jeffrey Carter: "Re: Private area and child packages"
- Reply: Martin Krischik: "Re: Private area and child packages"
- Reply: Stephen Leake: "Re: Private area and child packages"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Dec 2004 20:05:58 -0800
Is there any way to hide implementation detail from child packages? An
example, say I have a parent package like this:
package Some_Package is
type Secret_Type is private;
private
type Secret_Type is record
Secret_Value : Integer := 0;
end record;
end Some_Package;
I don't want any other component to be able to manipulate the
Secret_Value record component, not even a child package of
Some_Package.
Is there any way to do this? In C++, there is something called the
PIMPL idiom, where you hide implementation detail by holding a pointer
to an incomplete class, like this:
//SecretClass.h
class Implementation;//Class not yet fully defined
class SecretClass
{
public:
//publicly visible stuff
private:
Implementation* pImplementation;
};
So, no component outside of the implementation of SecretClass, (not
even other classes that inherit SecretClass), has any knowledge of the
structure of the implementation class. The full definition of the
Implementation class is not provided in the header containing the
definition of SecretClass. The Implementation class can either be
defined in the cpp file that defines SecretClass, or seperately.
I'm trying to figure out the most elegant way to do something like this
is Ada and would like to read any ideas/suggestions.
- Next message: Jeffrey Carter: "Re: Converting"
- Previous message: Nick Roberts: "Re: Converting"
- Next in thread: tmoran_at_acm.org: "Re: Private area and child packages"
- Reply: tmoran_at_acm.org: "Re: Private area and child packages"
- Reply: Jeffrey Carter: "Re: Private area and child packages"
- Reply: Martin Krischik: "Re: Private area and child packages"
- Reply: Stephen Leake: "Re: Private area and child packages"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]