Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
I have an interface that has all abstract methods, except one metho that I want every implementation of the interface to have. When I am implementing an interface, do I have to copy the whol subroutine from the interface to the implementation or is there a wa to make the implementation call the interface definition of th subroutine? Also does anyone have a good resource for interfaces and user define classes in VBA because I cannot really find any good ones? Thank -- reddog906 ----------------------------------------------------------------------- reddog9069's Profile: http://www.excelforum.com/member.php...fo&userid=2445 View this thread: http://www.excelforum.com/showthread.php?threadid=39068 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
Bump for a quick answer hopefully... -- reddog906 ----------------------------------------------------------------------- reddog9069's Profile: http://www.excelforum.com/member.php...fo&userid=2445 View this thread: http://www.excelforum.com/showthread.php?threadid=39068 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
Does anyone have any good info on interfaces or can someone answer m quick question -- reddog906 ----------------------------------------------------------------------- reddog9069's Profile: http://www.excelforum.com/member.php...fo&userid=2445 View this thread: http://www.excelforum.com/showthread.php?threadid=39068 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
Bump for any help from anyone -- reddog906 ----------------------------------------------------------------------- reddog9069's Profile: http://www.excelforum.com/member.php...fo&userid=2445 View this thread: http://www.excelforum.com/showthread.php?threadid=39068 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
reddog9069 wrote: I have an interface that has all abstract methods, except one method that I want every implementation of the interface to have. When I am implementing an interface, do I have to copy the whole subroutine from the interface to the implementation or is there a way to make the implementation call the interface definition of the subroutine? Also does anyone have a good resource for interfaces and user defined classes in VBA because I cannot really find any good ones? Thanks -- reddog9069 Hi, A good reference on the use of classes in VBA is "The VBA Developer's Handbook" http://www.amazon.com/exec/obidos/tg...books&n=507846 I have never played around with the Implements keyword so I can't answer your question. Maybe you could post it to a straight VB newsgroup. You seem to be asking for something like implementation inheritence, which is not directly supported in VB6 or VBA. There *is* a trick involving delegation that supposedly provides a work-around, but I honestly don't recall how it works. Maybe on a VB group (but not the VB.Net!)you can find an answer. Hope that helps -John Coleman ------------------------------------------------------------------------ reddog9069's Profile: http://www.excelforum.com/member.php...o&userid=24458 View this thread: http://www.excelforum.com/showthread...hreadid=390686 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
If it is not directly supported in VBA that is fine. I have no proble just copying the method into the implementation of the interface, bu that just seems like a big no no from a programming stand point. will give that book a look through, next time I am at a book store, o if it is available at my library I will check it out. I know on the msdn site they talk about interfaces having both abstrac and non-abstract components, but they only talk about simple things lik attributes, or properites and their corresponding get and let methods but nothing along the lines of complete sub routines or functions. I know it is so easy in c++ and java, using the virtual keyword, but cannot figure it out in VBA, so maybe VBA was not designed for thi complex of a program. Thank -- reddog906 ----------------------------------------------------------------------- reddog9069's Profile: http://www.excelforum.com/member.php...fo&userid=2445 View this thread: http://www.excelforum.com/showthread.php?threadid=39068 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
reddog9069,
All classes that Implement your interface must expose all of the routines found in the interface. Whilst the interface will have the signatures of the routines, these routines will not contain any code. What each class does within its respective routine is up to you. After you have typed 'Implements MyInterface" as the top of a class module, click the combo above and select "MyInterface". In the right combobox you will now see all the routines that you need to expose. 'Interface ITest Public Property Let MyText(vData As String) End Property Public Property Get MyText() As String End Property ---------------------------------- 'Class cTest Implements ITest Private Property Get ITest_MyText() As String ......code End Property Private Property Let ITest_MyText(RHS As String) ......code End Property That's the way I understand it anyway I am currently making a set of barcode classes (cEAN8, cEAN13, c2Of5, etc) that all implement the IBarcode interface: Number, size, check digit etc. However, how each class calculates the bars for its code is class dependent. In all, it means that I can: Dim BarcodeInstance as IBarcode Set BarcodeInstance = New cEAN13 'or cEAN8 or c2Of5 NickHK "reddog9069" wrote in message ... I have an interface that has all abstract methods, except one method that I want every implementation of the interface to have. When I am implementing an interface, do I have to copy the whole subroutine from the interface to the implementation or is there a way to make the implementation call the interface definition of the subroutine? Also does anyone have a good resource for interfaces and user defined classes in VBA because I cannot really find any good ones? Thanks -- reddog9069 ------------------------------------------------------------------------ reddog9069's Profile: http://www.excelforum.com/member.php...o&userid=24458 View this thread: http://www.excelforum.com/showthread...hreadid=390686 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quick Interface Question
scattered wrote:
reddog9069 wrote: I have an interface that has all abstract methods, except one method that I want every implementation of the interface to have. When I am implementing an interface, do I have to copy the whole subroutine from the interface to the implementation or is there a way to make the implementation call the interface definition of the subroutine? Also does anyone have a good resource for interfaces and user defined classes in VBA because I cannot really find any good ones? Thanks -- reddog9069 Hi, A good reference on the use of classes in VBA is "The VBA Developer's Handbook" http://www.amazon.com/exec/obidos/tg...books&n=507846 I have never played around with the Implements keyword so I can't answer your question. Maybe you could post it to a straight VB newsgroup. You seem to be asking for something like implementation inheritence, which is not directly supported in VB6 or VBA. There *is* a trick involving delegation that supposedly provides a work-around, but I honestly don't recall how it works. Maybe on a VB group (but not the VB.Net!)you can find an answer. Hope that helps -John Coleman Here is a useful link: http://www.vbip.com/books/186100172X...er_172X_08.asp Hope that helps -John Coleman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Quick little question | Excel Discussion (Misc queries) | |||
Quick Books interface | Excel Programming | |||
User Form Interface .... really a simple question! | Excel Programming | |||
QUI Expert: Excel-based User Interface or OO User Interface? | Excel Programming | |||
GUI Expert: Excel-based User Interface or OO User Interface? | Excel Programming |