Click here to Skip to main content
15,896,376 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: i want urgent reply Pin
Steven J Jowett22-Jan-09 5:21
Steven J Jowett22-Jan-09 5:21 
AnswerRe: i want urgent reply Pin
darkelv22-Jan-09 18:20
darkelv22-Jan-09 18:20 
QuestionInheritance Advice Needed Pin
Jay Royall21-Jan-09 0:15
Jay Royall21-Jan-09 0:15 
AnswerRe: Inheritance Advice Needed Pin
Mustafa Ismail Mustafa21-Jan-09 1:42
Mustafa Ismail Mustafa21-Jan-09 1:42 
GeneralRe: Inheritance Advice Needed Pin
Jay Royall21-Jan-09 2:28
Jay Royall21-Jan-09 2:28 
GeneralRe: Inheritance Advice Needed Pin
Mustafa Ismail Mustafa21-Jan-09 2:34
Mustafa Ismail Mustafa21-Jan-09 2:34 
GeneralRe: Inheritance Advice Needed Pin
Jay Royall21-Jan-09 2:46
Jay Royall21-Jan-09 2:46 
GeneralRe: Inheritance Advice Needed Pin
Mustafa Ismail Mustafa21-Jan-09 3:05
Mustafa Ismail Mustafa21-Jan-09 3:05 
OK, I have to be pedantic now, just for the sake of proper understanding.

An Interface is just a contract. It doesn't implement anything, its a prototype. Think of it as an agreement between you and another class where all you care about is how to call the class, what parameters to send it and what to expect from it. Other than that, its a black box, you don't know and in theory shouldn't care how things are implemented, you simply care about invoking (Method/Property) and the result.

The class that implements the interface will still have to implement those methods in their own way. So, to follow up on our example of the classes A,B and C, B and C being the classes that inherit the interface will have to implement it in their own code.

Here's a quick example:

<br />
Public Class BaseClass<br />
'Class Implementation goes here<br />
End Class<br />
<br />
Public Interface IShared<br />
'Interface definitions<br />
    Function DoSomething() as Integer    //see? Only the prototype, no implementation<br />
End Interface<br />
<br />
Public Class A<br />
  Inherits BaseClass<br />
'Class A implementation<br />
End Class<br />
<br />
Public Class B<br />
  Inherits BaseClass<br />
  Implements IShared<br />
'Class B implementation<br />
Public Function DoSomething() as Integer<br />
  Return 3 * 3<br />
End Function<br />
End Class<br />
<br />
Public Class C<br />
  Inherits BaseClass<br />
  Implements IShared<br />
'Class C implementation<br />
Public Function DoSomething() as Integer<br />
   Return 5<br />
End Function<br />
<br />
End Class<br />


Pay attention to the Interface and the implementations in Class B and C


Don't forget to vote if the response was helpful


Sig history

"dad" Ishmail-Samuel Mustafa

Unix is a Four Letter Word, and Vi is a Two Letter Abbreviation

GeneralRe: Inheritance Advice Needed Pin
Jay Royall21-Jan-09 3:25
Jay Royall21-Jan-09 3:25 
GeneralRe: Inheritance Advice Needed Pin
Mustafa Ismail Mustafa21-Jan-09 4:35
Mustafa Ismail Mustafa21-Jan-09 4:35 
AnswerRe: Inheritance Advice Needed Pin
Jon_Boy21-Jan-09 2:13
Jon_Boy21-Jan-09 2:13 
GeneralRe: Inheritance Advice Needed Pin
Jay Royall21-Jan-09 2:32
Jay Royall21-Jan-09 2:32 
GeneralRe: Inheritance Advice Needed Pin
Mustafa Ismail Mustafa21-Jan-09 2:37
Mustafa Ismail Mustafa21-Jan-09 2:37 
GeneralRe: Inheritance Advice Needed Pin
Ray Cassick21-Jan-09 4:28
Ray Cassick21-Jan-09 4:28 
Answersimple pedigree, no interfaces Pin
Luc Pattyn21-Jan-09 3:02
sitebuilderLuc Pattyn21-Jan-09 3:02 
GeneralRe: simple pedigree, no interfaces Pin
Jay Royall21-Jan-09 3:22
Jay Royall21-Jan-09 3:22 
GeneralRe: simple pedigree, no interfaces Pin
Luc Pattyn21-Jan-09 3:33
sitebuilderLuc Pattyn21-Jan-09 3:33 
Questionpermission denied while deleting folder Pin
jishbalan20-Jan-09 23:04
jishbalan20-Jan-09 23:04 
AnswerRe: permission denied while deleting folder Pin
EliottA21-Jan-09 2:43
EliottA21-Jan-09 2:43 
GeneralRe: permission denied while deleting folder Pin
Luc Pattyn21-Jan-09 3:10
sitebuilderLuc Pattyn21-Jan-09 3:10 
GeneralRe: permission denied while deleting folder Pin
jishbalan21-Jan-09 17:25
jishbalan21-Jan-09 17:25 
QuestionRe: permission denied while deleting folder Pin
Eddy Vluggen22-Jan-09 1:22
professionalEddy Vluggen22-Jan-09 1:22 
AnswerRe: permission denied while deleting folder Pin
jishbalan22-Jan-09 18:17
jishbalan22-Jan-09 18:17 
Questionautomation error Pin
subramanyeswari20-Jan-09 22:42
subramanyeswari20-Jan-09 22:42 
AnswerRe: automation error Pin
Mustafa Ismail Mustafa20-Jan-09 22:56
Mustafa Ismail Mustafa20-Jan-09 22:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.