
May 11th, 2012, 10:33 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Posts: 2
Time spent in forums: 9 m 7 sec
Reputation Power: 0
|
|
|
Inheriting from a class
I am writing an application in which I want to have a class which inherits from another. This app is a third party utility for the Madden video game. I'm working with data objects which represent player records in the game.
I have a class "Player" which will contain their basic data such as speed, catching ability, weight, etc.
I want to create an extended class "ExtendedPlayer" which will inherit that class, but will also deal with extended functions and attributes which I will create.
One problem seems to be with my understanding of Overrides. In the main class I have:
Overridable Sub Load(ByVal dbhandle As Integer, ByVal playerid As Integer)
I wanted it overridable because in the extended class, "Load" will load additional things. From the extended class:
Overrides Sub Load(ByVal dbhandle As Integer, ByVal dbhandle2 As Integer, ByVal playerid As Integer)
dbhandle2 represents a handle on the database which contains secondary data. But, I get error messages when I try to implement this, as if the sub "Load" doesn't exist in the original class. "does not override a sub in the base class."
Another question.... the dbhandle and dbhandle2 represent the handles for other databases I'm working with. They're assigned at the opening of my app, and I pass them everywhere. Is there any way to make them global in VB 2008 so that they can be used anywhere in the app?
|