Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb.net ... problem of implement interface polymorphism

Status
Not open for further replies.

cazellnu

Technical User
Aug 15, 2002
41
CA
I had some problem of apply interface polymorphism concept into my coding and I wonder if anyone know that there are some handly examples that can help me out (except the one in microsoft)

Thank You
 
interface jobs
sub execute()
end interface


class jobOne implements jobs
sub executeJobOne() implements jobs.execute
'do something
end sub
end class

class jobTwo implements jobs
sub executeJobTwo() implements jobs.execute
'do something
end sub
end class

class jobThree implements jobs
sub executeJobThree() implements jobs.execute
'do something
end sub
end class



dim arrayOfJobs as jobs() = {new jobOne(), new jobTwo(), new jobThreee()}

for i = 0 to arrayOfJobs.length
arrayofJobs(i).execute()
next



maybe something like that...basically you have the ability to call an objects methods based on its interface implementation because the object is guaranteed to have certain methods
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top