473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ 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(Conne ction) Then Return Connection.Serv erVersion
End Get
End Property
Public Function ExecuteReader(b yval SQL as String) As OleDbDataReader
Return Command.Execute Reader(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(Conne ction) Then Return Connection.Serv erVersion
End Get
End Property
Public Function Shadows ExecuteReader(b yval SQL as String) As OdbcDataReader
Return Command.Execute Reader(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 1239

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

Similar topics

4
2099
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) arguments, such as: FirstClass Public Sub Populate(string) Public Sub Populate(string, string) I don't have to use Overloads, because both methods are in the same class.
10
3216
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 see/reach it. I use this code :
10
3020
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
7131
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
1995
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 application. If you have not used the keyword 'Overridable' then read on for sure... If you setup a child class and you want to override a method in your base class, you may see the squiggles under your child's method name. The pop-up/build error says...
6
1658
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 AuthHeaderName As String Public SessionKey As String = "Default" End Class Public Class ServiceTicket:Inherits AuthHeader
5
1455
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 function' in the subclass. It works. Then i removed them in both classes, like here below: Public Class ford .....
3
1303
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 genius or something else besides. As it stands we're leaning towards something else but would welcome some outside comments. The situation is.
2
1799
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
7885
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5426
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3881
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1231
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.