Thomas Tutone wrote:
> Lucy Ludmiller wrote:
> > I have code like this :
> >
> > void foo(int i, void* p) { .. }
> >
> > class A
> > {
> > public:
> > A();
> > ~A();
> > private:
> > void foobar(int i, char* c);
> > };
> >
> > Is there a way for foo to call foobar() ?
>
> Sure:
>
> void foo(int i, void* p)
> {
> A a;
> a.foobar(i, static_cast<char*>(p));
> }
.... if class A declares foo as a friend:
class A
{
friend void foo(int i, void* p) ;
//.....
};
HTH
Radu
>
> But if your question is, can foo call foobar without an instance of
> class A to call it with, the answer is no, unless you change foobar to
> be a static member of A.
>
you can declaring
> Best regards,
>
> Tom
|