Looking for equivalent to 'friend'(C++) in object pascal 
Author Message
 Looking for equivalent to 'friend'(C++) in object pascal

I was wondering if there is function in Turbo Pascal that is equivalent
to the 'friend' function in C++? (This being a way of one object being
able to look at another object's private members.)

Thanks alot,
Shona Suderman

--
| Shona Suderman            |                                      |
| Computer Engineering      |   "If you want to make God laugh,    |
| University of Manitoba    |      just tell Him your plans."      |



Wed, 18 Jun 1902 08:00:00 GMT  
 Looking for equivalent to 'friend'(C++) in object pascal

Quote:
> I was wondering if there is function in Turbo Pascal that is equivalent
> to the 'friend' function in C++? (This being a way of one object being
> able to look at another object's private members.)

Nope.  Never had it, and (seeing as how it looks like the last release of
Turbo Pascal is already out) it probably never will.  There are a few
tricks on how to duplicate the idea, but they don't work all that well
and I bet you've already thought of them.  Sorry.  (Look on the bright
side--there is less to learn about Pascal!)

=============================================================
Douglas Cook, undergraduate in Computer Science at BYU
-------------------------------------------------------------
*REAL* programmers use COPY CON PROGRAM.EXE
=============================================================



Wed, 18 Jun 1902 08:00:00 GMT  
 Looking for equivalent to 'friend'(C++) in object pascal

Quote:

>> I was wondering if there is function in Turbo Pascal that is equivalent
>> to the 'friend' function in C++? (This being a way of one object being
>> able to look at another object's private members.)

>Nope.  Never had it, and (seeing as how it looks like the last release of
>Turbo Pascal is already out) it probably never will.  There are a few
>tricks on how to duplicate the idea, but they don't work all that well
>and I bet you've already thought of them.  Sorry.  (Look on the bright
>side--there is less to learn about Pascal!)

That's true, but not the whole story.  There is a way for one object
being able to look at another object's private members.  Just declare
them in the same unit.  The scoping rules say that all fields and
methods, private or not, are visible in the unit.  Private only hides
things from other units.

If you're stuck with a unit where something is declared private and
you need access to it from outside the unit, then you should redeclare
that thing as public.  If you can't recompile, then it's not hard to
patch the .TPU file to change the "private" bit; take a look at
INTRFC70.ZIP (available lots of places, including garbo.uwasa.fi) for
the TPU format.

Duncan Murdoch



Wed, 18 Jun 1902 08:00:00 GMT  
 Looking for equivalent to 'friend'(C++) in object pascal
On Tue, 16 Jan 1996 00:33:15 -0700, Douglas Evan Cook

Quote:


>> I was wondering if there is function in Turbo Pascal that is equivalent
>> to the 'friend' function in C++? (This being a way of one object being
>> able to look at another object's private members.)

>Nope.  Never had it, and (seeing as how it looks like the last release of
>Turbo Pascal is already out) it probably never will.  There are a few
>tricks on how to duplicate the idea, but they don't work all that well
>and I bet you've already thought of them.  Sorry.  (Look on the bright
>side--there is less to learn about Pascal!)

>=============================================================
>Douglas Cook, undergraduate in Computer Science at BYU
>-------------------------------------------------------------
>*REAL* programmers use COPY CON PROGRAM.EXE
>=============================================================

         Stefan Benzinger
Ispergasse 28      Regerstr. 1
1210 Wien          84489 Burghausen
0222/2925035       Deutschland 08677/3954


WWW: http://www.wu-wien.ac.at/usr/h89/h8950427/
                              Red Alert, Fire Phasers



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Need Gnu equivalent for type 'Registers'

2. Equivalent of C 'Union'

3. MW Object Pascal vs Delphi's Pascal

4. Calling C/C++ func's in PASCAL?

5. c++ dll's in Pascal 7.0

6. BDE 'Could not find object'

7. Initializing an object's fields to 0's

8. HELP Plse: Pascal equivalent of C++ Overloading

9. I'm looking for turbo pascal!!!!

10. I'm look for a Pascal lexical analyser

11. Equivalent to DisableDefault in Paradox's ObjectPAL?

12. I'm looking for a S3Graph-Unit for Pascal

 

 
Powered by phpBB® Forum Software