realbasic-nug
[Top] [All Lists]

Re: OOP friend

To: "REALbasic NUG" <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: OOP friend
From: "Keith Hutchison" <keith dot hutchison at balance-infosystems dot com>
Date: Mon, 31 Oct 2005 14:21:22 +1100
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20051030181811 dot 58969 dot qmail at web31802 dot mail dot mud dot yahoo dot com><43653509 dot 6010002 at ryandary dot com> <e85bf11b7d71f7112b18ee6e61860a10 at satx dot rr dot com>
You could make a class.friend method, returning boolean

public function friend ( class as variant ) as boolean
dim result = false
if class isa friendlyTypeOfClass then
   result = true
end if
if class isa differentFriendlyTypeOfClass then
   result = true
end if
return result
end function

the inside your other methods
public function someMethod( class as variant ) as integer
   if friend( class ) then
       // do some valid processing
   else
       return someInvalidresultLikeMinus1 // or something else
   end if
end function


----- Original Message ----- From: "William Squires" <wsquires at satx dot rr dot com>
To: "REALbasic NUG" <realbasic-nug at lists dot realsoftware dot com>
Sent: Monday, October 31, 2005 2:01 PM
Subject: Re: OOP



On Oct 30, 2005, at 3:03 PM, Ryan Dary wrote:

How does the Public/Protected/Private not do that for you now? In RB2005, you can choose from the following for every declared method of a class:

Public -  Accessible anywhere (inside or outside the class)

Protected - Accessible anywhere within the class or the subclasses.

Private - Accessible only by the class which declares it.

Would this be sufficient or are you needing something else? Perhaps I misunderstood the question..

Cheers,

Ryan Dary

I think he meant, "how can you make a class expose public methods, but only to another - specified, and different* - class?"

* By "differnt", I mean that the 'other' (different) class is neither a subclass nor a superclass of the original class (the one he wanted the methods exposed on).


Bob Gordon wrote:
Hello.
I've been working on (mainly playing around) with a
couple of things, and I'd like to run something by the
group:
Many times I need a class to have some public methods,
but I want them only visible to some other class that
will be the only user of this class. This other class
would have public methods/properties so it can be used
in a program.
For example, let's say I am making a help system.
There might be one or two methods a program would use
to open the help window and locate the desired topic.
But, inside the help system, there might be some sort
of help item. This would have its own public methods.
I would like to be able to hide such methods such that
they are visible inside the subsystem (component?) but
not visible outside.
Such a concept would simplify documentation and usage
for such subsystems. Is this something RB should have?
Is there a way to do it now?
-Bob Gordon
Coming Soon
The Book of Fictional Days 2006
A Strictly Limited Edition
For Information email gordon1bob at yahoo dot com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


William H Squires Jr
4400 Horizon Hill #4006
San Antonio, TX 78229
wsquires at satx dot rr dot com dot nospam <- remove the .nospam

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>