E
Eric
New to interfaces in VBA and getting an error that my class needs to
implement a method that it sure looks like it's doing! Is it because the
method is the Get of a Property??
[Error: Object Module needs to implement method 'LastID' from 'Interface
IAutoIdIncrementer']
Tia, Eric
========================================================================
Interface
'---------------------------------------------------------------------------------------
' Module : IAutoIdIncrementer
' Purpose : Interface for any class that needs to increment an ID
' Precon(s) : A portion of the id is always assumed to be numeric (so we can
apply simple
' addition to it), the interface makes no assumptions about
whther the ultimate
' id is actually a string or a number. That is an
implementation detail, allowing
' for custom id's that are not entirely numeric. The numeric
portion should be a
' long, however.
'---------------------------------------------------------------------------------------
Option Explicit
Public Property Get LastId() As Variant
End Property
Public Property Get NextId() As Variant
End Property
========================================================================
Class Implementation (start - won't compile as is)
'---------------------------------------------------------------------------------------
' Module : CAutoIdIncrementerExcel
' Purpose : Increment ID's where the id data is stored in and used in
Excel
'---------------------------------------------------------------------------------------
Option Explicit
Implements IAutoIdIncrementer
Private mvLastId As Variant
Private mvNextId As Variant
Public Property Get LastId() As Variant
LastId = mvLastId
End Property
Public Property Get NextId() As Variant
NextId = mvNextId
End Property
implement a method that it sure looks like it's doing! Is it because the
method is the Get of a Property??
[Error: Object Module needs to implement method 'LastID' from 'Interface
IAutoIdIncrementer']
Tia, Eric
========================================================================
Interface
'---------------------------------------------------------------------------------------
' Module : IAutoIdIncrementer
' Purpose : Interface for any class that needs to increment an ID
' Precon(s) : A portion of the id is always assumed to be numeric (so we can
apply simple
' addition to it), the interface makes no assumptions about
whther the ultimate
' id is actually a string or a number. That is an
implementation detail, allowing
' for custom id's that are not entirely numeric. The numeric
portion should be a
' long, however.
'---------------------------------------------------------------------------------------
Option Explicit
Public Property Get LastId() As Variant
End Property
Public Property Get NextId() As Variant
End Property
========================================================================
Class Implementation (start - won't compile as is)
'---------------------------------------------------------------------------------------
' Module : CAutoIdIncrementerExcel
' Purpose : Increment ID's where the id data is stored in and used in
Excel
'---------------------------------------------------------------------------------------
Option Explicit
Implements IAutoIdIncrementer
Private mvLastId As Variant
Private mvNextId As Variant
Public Property Get LastId() As Variant
LastId = mvLastId
End Property
Public Property Get NextId() As Variant
NextId = mvNextId
End Property