On Mar 22, 2007, at 15:29 UTC, Arnaud Nicolet wrote:

> I'm also interested in this technique, but I know nothing about  
> interfaces (I know about classes, though). I'd like to understand  
> this (actually I was not even able to create a class that has  
> "actionNotificationReceiver" among its interfaces).

Why?  What happened when you tried?  If you typed it directly into the
Interfaces property, are you sure you spelled it correctly?

> Can you recommend a way to learn interfaces directly from RB?

They're not tricky; let's just cover them here.

An Interface is like a class, except that it only defines the
prototypes (name, parameters, and return type) of its methods.  It
doesn't contain any code or properties, and you can't instantiate it
directly (i.e. you can't use it with "New").

But other classes can "implement" an interface, which means that they
declare it in their Interfaces list, and they implement each of the
methods that interface defines.  The easiest way to implement an
interface is to control-click on your class in the Project tab, choose
"Implement Interface..." from the contextual menu, and then check off
the interface(s) you want to implement in the list that appears.  This
will also add the methods of that interface to your class, so all you
have to do is fill in the code.

Interfaces are very handy because, while a class can have only one
superclass, it can implement as many interfaces as it likes.  Even
windows can implement interfaces.  And an interface is a type, just
like a class; you can declare variables or parameters of that type, and
you can test for an interface with IsA.

I won't go into all the deep reasons why single inheritance but
multiple interfaces is great language design, but suffice to say that
it is very convenient once you get the hang of it.

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

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

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to