Results 1 to 4 of 4

Thread: Using Implements Keyword

  1. #1

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Unhappy Using Implements Keyword

    Hello Everybody,
    I have been developing components and always been using them through the CreateObject Method.
    I know that there are other methods to use components as well and I am sure most of you might be aware of the Implements Keyword.
    Well I wish to use that method for exposing a particular private function of a class.

    Firstly do you know whether the Implements can be used in anything other than a class?
    Secondly what is the exact syntax of using the implements keyword. I keep on getting it wrong.

    Here is my problem in a bit more detail :-

    My vbproject is registered as Something and the class is called SomeClass.

    If I wish to expose the "Private Function CompareData Method" of this class, using the Implements Keyword how should I go about it.


    Public Function calculateLCM(ByVal iInputOne As Long, _
    iInputTwo As Long) As Double
    calculateLCM = dLcmProduct
    End Function

    Private Function CompareData(ByVal collFactorsOne As Collection, _
    ByVal collFactorsTwo As Collection _
    ) As Double
    Dim xdResult As Double


    CompareData = xdResult

    End Function


    I wish to expose the CompareData Method in my program exe. Since it is a private function, I know that it cannot be done by creating an instance of the object.


    Regards,
    Abhijit Shrikhande

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    From MSDN:
    When a Visual Basic class implements an interface, the Visual Basic class provides its own versions of all the Public procedures specified in the type library of the Interface.
    Therefore, you can not expose the private procedures. Also when using Implements keyword, your super class should only contain the interface, all the implementation will be done in the sub-class.

    Regards,
    TheBao

  3. #3
    Junior Member robinm's Avatar
    Join Date
    May 2001
    Location
    London
    Posts
    19

    Implements

    As VB does not have inheritance, you will have a problem here.

    Implements will only provide a 'FrameWork' if you like for the method.
    No code in the method.
    To imitate is human... to copy without recognition is theft.

  4. #4

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Smile

    THANKS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width