demand. For this purpose, the Base Class Library
demand. For this purpose, the Base Class Library defines a second destructor called Dispose. Its general syntax and usage is: Class classname Implements IDisposable Public Sub Dispose( ) Implements IDisposable.Dispose ‘ cleanup code goes here ‘ call child objects’ Dispose methods, if necessary, here End Sub ‘ Other class code End Class Note that classes that support this callable destructor must implement the IDisposable interface hence the Implements statement just shown. IDisposable has just one member, the Dispose method. It is important to note that it is necessary to inform any clients of the class that they must call this method specifically in order to release resources. (The technical term for this is the manual approach!) 3.4 Inheritance Perhaps the best way to describe inheritance as it is used in VB .NET is to begin with an example. The classes in a given application often have relationships to one another. Consider, for instance, our Employee information application. The Employee objects in the class CEmployee represent the general aspects common to all employees name, address, salary, and so on. Of course, the executives of the company will have different perquisites than, say, the secretaries. So it is reasonable to define additional classes named CExecutive and CSecretary, each with properties and methods of its own. On the other hand, an executive is also an employee, and there is no reason to define different Name properties in the two cases. This would be inefficient and wasteful. This situation is precisely what inheritance is designed for. First, we define the CEmployee class, which implements a Salary property and an IncSalary method: ‘ Employee class Public Class CEmployee ‘ Salary property is read/write Private mdecSalary As Decimal Property Salary( ) As Decimal Get Salary = mdecSalary End Get Set mdecSalary = Value End Set End Property Public Overridable Sub IncSalary(ByVal sngPercent As Single) mdecSalary = mdecSalary * (1 + CDec(sngPercent)) End Sub End Class Next, we define the CExecutive class: ‘ Executive Class
Hint: If you are looking for very good and affordable webspace to host and run your j2ee hosting application check Virtualwebstudio j2ee web hosting services