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, 5580👍, 0💬
Popular Posts:
Can include files be nested? The answer is yes. Include files can be nested any number of times. As ...
What will be printed as the result of the operation below: main() { char *ptr = " Cisco Systems"; *p...
How To Assign Debug Privileges to a User? - Oracle DBA FAQ - Introduction to Oracle SQL Developer In...
What Happens to Your Transactions When ERROR 1213 Occurred? - MySQL FAQs - Transaction Management: C...
Can you explain in GSC and VAF in function points? In GSC (General System Characteristic) there are ...