-
Jul 22nd, 2024, 06:34 AM
#1
Thread Starter
Lively Member
how to use a method that is defined in an interface
Hello,
I have an interface and a method is defined inside it.
how can i use this method ?
here is the interface:
Public Interface ICalculationContext
Property ContractPolicy As BasePolicy
Property ContractCarry As CarryOver
Property PartPolicy As BasePolicy
Property PartCarry As CarryOver
Property Ab As ActuarialBasis
Function GetPivotCategoryValue(category As PivotCategoryTypes) As String
End Interface
thanky you in advance
-
Jul 22nd, 2024, 07:13 AM
#2
Re: how to use a method that is defined in an interface
It depends on what exactly you mean by "use this method".
An interface isn't something that directly contains code, it describes required functionality (think of it like a contract).
Are you trying to use a class that already implements this interface or are you looking at implementing it yourself?
-
Jul 22nd, 2024, 07:13 AM
#3
Re: how to use a method that is defined in an interface
You can't use it directly. You have to define a class that implements the interface and that implements the method. Different classes can implement interface members in different ways, which is the whole point. You can call the same method on any class that implements that interface and it will work, but what the method actually does depends on the class.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|