469,963 Members | 2,115 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Question about shadows and inheritance

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 1119

Post your reply

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

Similar topics

4 posts views Thread by Christopher W. Douglas | last post: by
10 posts views Thread by Özden Irmak | last post: by
7 posts views Thread by Satish | last post: by
6 posts views Thread by tshad | last post: by
5 posts views Thread by Ben | last post: by
3 posts views Thread by =?Utf-8?B?UnVwZXJ0IFRheWxvcg==?= | last post: by
2 posts views Thread by Siegfried Heintze | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.