delorie.com/archives/browse.cgi | search |
Message-ID: | <001801be2e72$b98c9460$f36195cc@uic> |
From: | "Andrew Deren" <aderen AT interaccess DOT com> |
To: | <djgpp AT delorie DOT com> |
Subject: | Re: Class Question |
Date: | Wed, 23 Dec 1998 06:49:47 -0600 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 4.72.3110.1 |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
Reply-To: | djgpp AT delorie DOT com |
> Is their a way to make a global function acsess the private members >of a class directly? In other words can you make global functions >friends of classes? > Thanks, > Ardy > http://www.addr.com/~ardy/ Sure you can. Let's say you have a function func() and declare it in myfile.h: extern void func(); and then define it somewhere in some other file and then you have a class Object which is declared in object.h. You have to #include "myfile.h" and then make func() to be a friend of your object class object { ... friend void func(); };
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |