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, 5382👍, 0💬
Popular Posts:
Wha is the output from System.out.println("Hell o"+null);?Hellonull
What Is C Language? The C programming language is a standardized programming language developed in t...
What is the concept of XPOINTER? XPOINTER is used to locate data within XML document. XPOINTER can p...
What exactly happens when ASPX page is requested from Browser? Note: - Here the interviewer is expec...
Can each Java object keep track of all the threads that want to exclusively access to it?