By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,593 Members | 2,006 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,593 IT Pros & Developers. It's quick & easy.

Adding a function to an interface????

P: 1
Hello everyone,

I need your help, how could you add a function to an interface... i'll give you an example.

i have to add a new public function to an interface that i have here called
PaidHoliday
Data type returned: Double
and the parameters: CurrentYear

Do i have to use an example of this :

Function PaidHoliday (ByVal currentYear As Integer) As Double

But how to finish it???

Thank you
Nov 15 '06 #1
Share this Question
Share on Google+
2 Replies


100+
P: 267
Hello everyone,

I need your help, how could you add a function to an interface... i'll give you an example.

i have to add a new public function to an interface that i have here called
PaidHoliday
Data type returned: Double
and the parameters: CurrentYear

Do i have to use an example of this :

Function PaidHoliday (ByVal currentYear As Integer) As Double

But how to finish it???

Thank you
hi there

note that you may only use the Public Statement in Modules ! otherwise change to private

call your function as Answer=PaidHoliday(2006) , where Answer should be declared as double

do some calculations is the function otherwise you won't get paid :)
maybe add some Errortrap

finish with End Function
Nov 15 '06 #2

100+
P: 1,646
Hello everyone,

I need your help, how could you add a function to an interface... i'll give you an example.

i have to add a new public function to an interface that i have here called
PaidHoliday
Data type returned: Double
and the parameters: CurrentYear

Do i have to use an example of this :

Function PaidHoliday (ByVal currentYear As Integer) As Double

But how to finish it???

Thank you
Hi. Here is an example;
Expand|Select|Wrap|Line Numbers
  1. Dim dblResult As Double
  2.  
  3. dblResult = PaidHoliday(2005) 'dblResult is 25.3
  4. dblResult = PaidHoliday(2002) 'dblResult is 22.6
  5.  
  6. Private Function PaidHoliday (ByVal currentYear As Integer) As Double
  7.    'do something here with currentYear eg
  8.    If currentYear = 2005 Then
  9.       PaidHoliday = 25.3
  10.    Else
  11.       PaidHoliday = 22.6
  12.    End If
  13. End Function
  14.  
Nov 15 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.