Help with Inheritance

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: D Miller (demiller2002_at_yahoo.com)
Date: 04/10/04


Date: Sat, 10 Apr 2004 15:53:20 GMT

This may be a basic question, but it sure has me stumpted..

I have two classes, Class1 and Class2. Class 2 inherits class one. Each
class has some varibles that need to be reset from time to time, so I have
created a method call "Clear" that does that. So my question is when using
"Clear" in an instance of class two, the clear method in Class one does not
get called, is there some way of excucting both "Clear" Methods in a single
call... See the code below for what I mean...

There must be a simple way of doing this, and I suspect I'm going to feel
pretty foolish when someone points it out, but it sure has me stumped at the
moment...

Thank you,
David

Public Class1
     dim mQty as integer
    dim mPrice as double

    Public Sub Clear
        mPrice = 0
        mQty =0
    end sub

    Public Property Price as Double
        Get
            return mPrice
        end get
        Set(ByVal Value as Double)
            mPrice = Value
        end set
    end property

    Public Property Qty as Integer
        Get
            return mQty
        end get
        Set(ByVal Value as Integer)
            mQty = Value
        end set
    end property
end class

Public Class2
    inherits Class1
   dim mInvoice as integer

    Public Shadows Sub Clear
        ' HERE IS WHERE THE QUESTION IS. IS THERE SOME WAY OF HAVING THIS
METHOD RUN THE CLEAR METHOD OF CLASS1?
        mInvoice = 0
    end sub

    Public Property Invoice as Integer
        Get
           return mInvoice
        end get
       Set(ByVal Value as Integer)
            mInvoice = Value
        end set
    end property
end class

i



Relevant Pages

  • Re: How to disable an other subroutine temporary?
    ... Be warned that event macros will not fire unless the property is explicitly ... reset to True. ... > "Worksheet_Calculate" sub on that sheet as well. ... > Dim sh1 As Worksheet ...
    (microsoft.public.excel.programming)
  • Re: Only step through cells that are "Active"
    ... Sub select_range ... To reset the used range before running the code, ... 'this function returns the range from Activecell to cell which is the ... Dim i As Integer, c As Integer, R As Integer ...
    (microsoft.public.excel.programming)
  • Re: VBA Help
    ... reset a couple more .Find properties and variable declarations. ... match SAM5abcd, or SAM5ABCD or SAM50001. ... Sub SAndR() ... Dim rngReplace As Word.Range ...
    (microsoft.public.word.vba.general)
  • different times with autofilter row deletes
    ... is also saved to reset the used range. ... It then times the filter and delete operation - deleting the "a" ... Dim rows_to_delete As Range ... End Sub ...
    (microsoft.public.excel.programming)
  • Project Error
    ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
    (microsoft.public.vb.bugs)