Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How can we acheive inheritance in VB.NET
How can we acheive inheritance in VB.NET ?
✍: Guest
Inheritance is achieved by using “Inherits” keyword in VB.NET (For C# it is “:”). Simple Sample is provided in CD for understanding inheritance in folder “WindowsApplicationInheritance”. There are two classes one is the parent “ClsParent” and second is the child “ClsChild”. Parent class has a string which has to parsed for junk data “@” and “/”.ClsParent has the functionality which parses only cleans up “@”.”ClsChild” then inherits from parent and adds extra functionality by parsing “/”.
Public Class ClsParent Protected strData As String = “jksdhkj@dadad///ajkdhsjakd” Public Function Parse() As String Dim PstrData As String PstrData = strData PstrData = Replace(PstrData, “@”, “”) Return PstrData End Function Public Function GetActualString() As String Return strData End Function End Class
Above is the source which parses only “@” of strData variable. Public Class ClsChild Inherits ClsParent ‘ this is child and a special parse function is added which will also parse “/” Public Function ParseBackSlash() Dim PstrData As String PstrData = Me.Parse() PstrData = Replace(PstrData, “/”, “”) Return PstrData End Function End Class
Above is the source code for “ClsChild” which does the remaining work. It adds extra
functionality by parsing “/” junk character’s of the data.
Note:- Strdata was accessible only because it was defined as protected in the parent class.
2007-10-23, 5260👍, 0💬
Popular Posts:
Who Developed HTML? HTML was originally developed by Tim Berners-Lee while at CERN, and popularized ...
Who Developed HTML? HTML was originally developed by Tim Berners-Lee while at CERN, and popularized ...
Describe in detail Basic of SAO architecture of Remoting? For these types of questions interviewer e...
Explain simple Walk through of XmlReader ? In this section we will do a simple walkthrough of how to...
What will be printed as the resultof the operation below: int x; int modifyvalue() { return(x+=10); ...