Re: Minimal working example (Re: set_buffer_mode)

"Per Hedbor () @ Pike (-) importm?te f?r mailinglistan" <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
> You mean, if the class is defined in the same file?
> That won't help much, I think, I need it between different files.

No, files are not something pike really knows about at that level, and
it would not make sense for 'private' and 'protected'.

If they share the same class.

Files are not really a computer language concept in any language I
know about, really.

Anyway: If the objects are instances of the same class (or are the
same object, for that matter), indexing can access private and
protected variables.

If both objects have a a common class in the class tree, you can
access variables defined in that class, but not those defined by
inheriting classes.

> Erm, I'd expect the evaluation and declaration order be similar to
> whenever we make a reference to another class.

And that is what is rather hard, because if you write 'friend class X'
X has to be either compiled at that point, or be previously know. You
can easily end up with circular references, or using placeholder
programs.

Technically speaking it would work if X is in a different file,
unless it refer back to something in the current file that is below
the reference, or above the use in the current file.

Martins suggestion to inherit a BFF class would work, but not with my
suggested security: You could only access variables defined _in_ the
BFF class.

-- 
Per Hedbor
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.