Implement an Interface : Interface « Class « VB.Net

VB.Net
1. 2D
2. Application
3. Class
4. Data Structure
5. Database ADO.net
6. Development
7. Event
8. File Directory
9. Generics
10. GUI
11. Language Basics
12. Network Remote
13. Thread
14. Windows System
15. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net Tutorial
VB.Net » Class » InterfaceScreenshots 
Implement an Interface
Implement an Interface

Imports System
Imports System.Collections


Public Class MainClass

  Shared Sub Main()

    Dim e1 As New Programmer("E1"50000)
    Dim e2 As New Employee("E2"40000)
    
    Dim theTeam As Employee() {e1, e2}
    
    e1.MyTeam = theTeam
    
    Console.WriteLine(e1.Rate(e2))
    
  End Sub
End Class


Public Interface ILead
  Sub SpendMoraleFund(ByVal amount As Decimal)
  Function Rate(ByVal aPerson As EmployeeAs String
  Property MyTeam() As Employee()
  Property MoraleFund() As Decimal
End Interface

Public Class Programmer
  Inherits Employee
  Implements ILead
  Private m_MoraleFund As Decimal
  Private m_MyTeam As Employee()
  Public Function Rate(ByVal aPerson As EmployeeAs String _
  Implements ILead.Rate
    Return aPerson.TheName & " rating to be done"
  End Function
  Public Property MyTeam() As Employee() _
  Implements ILead.MyTeam
    Get
      Return m_MyTeam
    End Get
    Set(ByVal Value As Employee())
      m_MyTeam = Value
    End Set
  End Property
  Public Sub SpendMoraleFund(ByVal amount As Decimal_
  Implements ILead.SpendMoraleFund
    'spend some money
    Console.WriteLine("Spent " & amount.ToString())
  End Sub
  Public Property OurMoraleFund() As Decimal Implements ILead.MoraleFund
    Get
      Return m_MoraleFund
    End Get
    Set(ByVal Value As Decimal)
      m_MoraleFund = Value
    End Set
  End Property
  Public Sub New(ByVal theName As String, ByVal curSalary As Decimal)
    MyBase.New(theName, curSalary)
  End Sub
End Class

Public Class Employee
  Private m_Name As String
  Private m_Salary As Decimal

  Public Sub New(ByVal theName As String, ByVal curSalary As Decimal)
    m_Name = theName
    m_Salary = curSalary
  End Sub

  Public ReadOnly Property TheName() As String
    Get
      Return m_Name
    End Get
  End Property

  Public ReadOnly Property Salary() As Decimal
    Get
      Return MyClass.m_Salary
    End Get
  End Property

End Class


           
       
Related examples in the same category
1. One Class implements two Interfaces which have the same name methodOne Class implements two Interfaces which have the same name method
2. Interface inherits interfaceInterface inherits interface
3. Class implements two interfaces
4. Implements an InterfaceImplements an Interface
5. Define and use Interface AgeDefine and use Interface Age
6. Interface Inherits another InterfaceInterface Inherits another Interface
7. Define and use InterfaceDefine and use Interface
8. Implements Two InterfacesImplements Two Interfaces
9. Generic Class and InterfaceGeneric Class and Interface
www.j_a__v_a2___s__._co_m___ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.