473,474 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question about shadows and inheritance

1 New Member
Hi all, i hope i can explain mysel, english is no my first language.
Well, i have a base class (a wrapper to work with oledb) with some properties and methods, and i have a inherited class (wrapper to odbc), something like this:
Public Class Base
Protected Connection as OleDbConnection
Protected Command as OleDbCommand
Public ReadOnly Property ServerVersion as String
Get
If Not IsNothing(Connection) Then Return Connection.ServerVersion
End Get
End Property
Public Function ExecuteReader(byval SQL as String) As OleDbDataReader
Return Command.ExecuteReader(SQL)
End Function
End Class
Public Class Child
Inherits Base
Protected Shadows Connection As OdbcConnection
Protected Shadows Command As OdbcCommand
Public Shadows ReadOnly Property ServerVersion as String
Get
If Not IsNothing(Connection) Then Return Connection.ServerVersion
End Get
End Property
Public Function Shadows ExecuteReader(byval SQL as String) As OdbcDataReader
Return Command.ExecuteReader(SQL)
End Function
End Class

How can I achieve something like that but with less code?, if i dont repeate the code of every property in the child class it uses the Connection objet of the base class (returning "" in the ServerVersion property for example), or what is the correct way of doing this, thanks a lot.

Juan Zamudio
Oct 18 '06 #1
0 1227

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Christopher W. Douglas | last post by:
I am developing a VB.NET app using Visual Studio.NET 2003. VB.NET allows me to create a class with two or more methods that have the same name, as long as they have different (non-optional)...
10
by: Özden Irmak | last post by:
Hi, I'm trying to hide an event of my custom usercontrol derived control, something like "Shadows" in VB.Net, but although the event is hidden from PropertyGrid, from CodeEditor I can still...
10
by: Lino Barreca | last post by:
Take a look at this code: Class clsAnagrafica Public Overridable ReadOnly Property Codice() As Integer Get Return 1 End Get End Property End Class
7
by: Satish | last post by:
Hi Friends I am little confused about the shadows keyword in VB.NET could anyone explain with an example about Shadows keyword Many thanks Satish
3
by: flat_ross | last post by:
For anyone who is just getting into VB.NET and/or is starting to work with inheritance I would like to point out a potential pitfall. We found this confusion recently when code-reviewing an...
6
by: tshad | last post by:
I am playing with Inheritance and want to make sure I understand it. I have the following Classes: ******************************************* Public Class AuthHeader:Inherits SoapHeader Public...
5
by: Ben | last post by:
Hi, i defined a function in the base class 'ford' and the same function (with different output) in subclass "peugeot". I first put 'Overridable function' in the base class and 'Overrides...
3
by: =?Utf-8?B?UnVwZXJ0IFRheWxvcg==?= | last post by:
Hi This question is based around VB.Net but could probably apply to c# or any OOP language as well. We found some old (ish) code in our code base and have been unable to decide if it is pure...
2
by: Siegfried Heintze | last post by:
Both C# and VB.NET have some strange keywords. When would someone want to use NotInheritable (or sealed in C#)? When would someone want to use shadows? Thanks, Siegfried
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.