What I am looking to do is map the implementation of interface
properties and functions to an inherited method of the base class.
Please see below.
'************************************************* ***************************
' Issues
'************************************************* ***************************
Note:
1. The abstract class (BaseRemoteDataObject) wants the derived
classes to use it's ConnectString and DataRow properties'
implementation, but requires the data manipulation methods to be
overridden.
2. The interface that the clients will use (IPerson) allows
access to the DataRow, but not the ConnectString. It also edxposes
the data manipulation methods.
3. The public interface for the implementation class (Person)
only allows Write access to the ConnectString (which IPerson doesn't
recognize)
QUESTION: How do I map IPerson.DataRow() to
BaseRemoteDataObject.DataRow through class Person.
In other words, I want BaseRemoteDataObject.DataRow to fulfill the
IPerson.DataRow requirement in Person.DataRow.
Do I have to provide a pass through implementation for each
method/property to mybase.property?
Public Property DataRow() As System.Data.DataRow Implements
IPerson.DataRow
Get
return mDataRow
End Get
Set(ByVal Value As System.Data.DataRow)
mDataRow = Value
End Set
End Property
Am I making sense to anyone? TIA
'************************************************* ***************************
' Sample Code
'************************************************* ***************************
MY ABSTRACT CLASS
Public MustInherit Class BaseRemoteDataObject
Inherits BaseRemoteObject
Protected mstrConnectString As String
Protected mDataRow As System.Data.DataRow
Public Property DataRow() As System.Data.DataRow
Get
Return mDataRow
End Get
Set(ByVal Value As System.Data.DataRow)
mDataRow = Value
End Set
End Property
Public Property ConnectString() As String
Get
Return mstrConnectString
End Get
Set(ByVal Value As String)
mstrConnectString = Value
End Set
End Property
Public MustOverride Function CancelChanges() As Boolean
Public MustOverride Function Clear() As Boolean
Public MustOverride Function Retrieve(ByVal ID As Integer) As
Integer
Public MustOverride Function Save() As Integer
End Class
MY INTERFACE
Public Interface IPerson
Event HasChanged(ByVal DataHasChanged As Boolean)
ReadOnly Property ID() As Int32
Property FirstName() As String
Property LastName() As String
ReadOnly Property IsChanged() As Boolean
Property DataRow() As DataRow
Function Retrieve(ByVal ID As Int32) As Int32
Function Save() As Int32
Function Clear() As Boolean
Function CancelChanges() As Boolean
End Interface
MY IMPLEMENTATION
Public Class Person
Inherits BaseRemoteDataObject
Implements IPerson
Public Event HasChanged(ByVal DataHasChanged As Boolean)
Implements IPerson.HasChanged
'Original Property Values
Protected p_strFirstname As String
Protected p_strLastname As String
Protected p_intID As Int32
'Current Property Values
Protected strFirstname As String
Protected strLastname As String
Protected intID As Int32
Protected blnChanged As Boolean
Public Shadows WriteOnly Property ConnectString() As String
Set(ByVal Value As String)
MyBase.mstrConnectString = Value
End Set
End Property
<< Most Code Omitted>>
End Class 4 2717
Hi Ray,
Please modifiy the DataRow Property in the ABSTRACT CLASS and MY
IMPLEMENTATION as follows.
'MY ABSTRACT CLASS
Public Overridable Property DataRow() As System.Data.DataRow
Get
Return mDataRow
End Get
Set(ByVal Value As System.Data.DataRow)
mDataRow = Value
End Set
End Property
'MY IMPLEMENTATION
Public Overrides Property DataRow() As DataRow Implements
IPerson.DataRow
Get
DataRow = MyBase.DataRow
End Get
Set(ByVal Value As DataRow)
MyBase.DataRow = Value
End Set
End Property
The Overrides keyword will inherit the DataRow property from the
BaseRemoteDataObject class and it will implements IPerson.DataRow.
Did I misunderstand your meaning?
If you have any further related question, please feel free to let me know.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- From: Ray Dukes <rd****@emfbroadcasting.com> Newsgroups: microsoft.public.dotnet.languages.vb Subject: HOWTO: Map interface declaration to a base class method? - TIA Message-ID: <fm********************************@4ax.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 127 NNTP-Posting-Host: 64.57.103.130 X-Complaints-To: ab***@prodigy.net X-Trace: newssvr25.news.prodigy.com 1062538299 ST000 64.57.103.130 (Tue,
02 Sep 2003 17:31:39 EDT)NNTP-Posting-Date: Tue, 02 Sep 2003 17:31:39 EDT Organization: SBC http://yahoo.sbc.com X-UserInfo1:
Q[R_PJONGBWYR_LXIRHFJFTBTR\B@GXLN@GZ_GYO^ZWZUYICD^RA QBKZQTZTX\_I[^G_KGFNON[Z
OE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ@CD^HKANYVW@RLGEZEJN@\_WZJBNZYYKVIOR]T]MNMG_
Z[YVWSCH_Q[GPC_A@CARQVXDSDA^M]@DRVUM@RBMDate: Tue, 02 Sep 2003 21:31:39 GMT Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!npeer.de.kpn-eurorings.net!in.100proofnews.com!in.100proofnews. com!prod
igy.com!prodigy.com!newsmst01.news.prodigy.com!pro digy.com!postmaster.news.p
rodigy.com!newssvr25.news.prodigy.com.POSTED!fbab4 d1e!not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133630 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class.
Please see below.
'************************************************ **************************
**' Issues '************************************************ **************************
**
Note: 1. The abstract class (BaseRemoteDataObject) wants the derived classes to use it's ConnectString and DataRow properties' implementation, but requires the data manipulation methods to be overridden.
2. The interface that the clients will use (IPerson) allows access to the DataRow, but not the ConnectString. It also edxposes the data manipulation methods.
3. The public interface for the implementation class (Person) only allows Write access to the ConnectString (which IPerson doesn't recognize)
QUESTION: How do I map IPerson.DataRow() to BaseRemoteDataObject.DataRow through class Person.
In other words, I want BaseRemoteDataObject.DataRow to fulfill the IPerson.DataRow requirement in Person.DataRow.
Do I have to provide a pass through implementation for each method/property to mybase.property? Public Property DataRow() As System.Data.DataRow Implements IPerson.DataRow Get return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property
Am I making sense to anyone? TIA
'************************************************ **************************
**' Sample Code '************************************************ **************************
**
MY ABSTRACT CLASS Public MustInherit Class BaseRemoteDataObject Inherits BaseRemoteObject Protected mstrConnectString As String Protected mDataRow As System.Data.DataRow
Public Property DataRow() As System.Data.DataRow Get Return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property Public Property ConnectString() As String Get Return mstrConnectString End Get Set(ByVal Value As String) mstrConnectString = Value End Set End Property
Public MustOverride Function CancelChanges() As Boolean Public MustOverride Function Clear() As Boolean Public MustOverride Function Retrieve(ByVal ID As Integer) As Integer Public MustOverride Function Save() As Integer End Class
MY INTERFACE Public Interface IPerson Event HasChanged(ByVal DataHasChanged As Boolean)
ReadOnly Property ID() As Int32 Property FirstName() As String Property LastName() As String ReadOnly Property IsChanged() As Boolean Property DataRow() As DataRow
Function Retrieve(ByVal ID As Int32) As Int32 Function Save() As Int32 Function Clear() As Boolean Function CancelChanges() As Boolean End Interface
MY IMPLEMENTATION Public Class Person Inherits BaseRemoteDataObject Implements IPerson Public Event HasChanged(ByVal DataHasChanged As Boolean) Implements IPerson.HasChanged
'Original Property Values Protected p_strFirstname As String Protected p_strLastname As String Protected p_intID As Int32
'Current Property Values Protected strFirstname As String Protected strLastname As String Protected intID As Int32
Protected blnChanged As Boolean
Public Shadows WriteOnly Property ConnectString() As String Set(ByVal Value As String) MyBase.mstrConnectString = Value End Set End Property
<< Most Code Omitted>>
End Class
My question is this:
When implementing an interface in a derived class, is there a way to
map the interface method definition (Implements IPerson.DataRow)
directly to the INHERITED function call, without having to provide an
implementation in the derived class.
In other words, I want to map IPerson.DataRow to
BaseRemoteDataObject.DataRow WITHOUT overriding with a new
implementation in the Person class. I want the interface to use the
inherited behavior, not redefine the behavior.
(I've seen nothing in the documentation that indicates that this is
possible.)
Thanks very much for responding.
Ray Dukes
On Wed, 03 Sep 2003 08:14:16 GMT, v-******@online.microsoft.com (Peter
Huang [MSFT]) wrote: Hi Ray,
Please modifiy the DataRow Property in the ABSTRACT CLASS and MY IMPLEMENTATION as follows.
'MY ABSTRACT CLASS Public Overridable Property DataRow() As System.Data.DataRow Get Return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property
'MY IMPLEMENTATION Public Overrides Property DataRow() As DataRow Implements IPerson.DataRow Get DataRow = MyBase.DataRow End Get Set(ByVal Value As DataRow) MyBase.DataRow = Value End Set End Property
The Overrides keyword will inherit the DataRow property from the BaseRemoteDataObject class and it will implements IPerson.DataRow.
Did I misunderstand your meaning? If you have any further related question, please feel free to let me know.
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. --------------------From: Ray Dukes <rd****@emfbroadcasting.com> Newsgroups: microsoft.public.dotnet.languages.vb Subject: HOWTO: Map interface declaration to a base class method? - TIA Message-ID: <fm********************************@4ax.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 127 NNTP-Posting-Host: 64.57.103.130 X-Complaints-To: ab***@prodigy.net X-Trace: newssvr25.news.prodigy.com 1062538299 ST000 64.57.103.130 (Tue, 02 Sep 2003 17:31:39 EDT)NNTP-Posting-Date: Tue, 02 Sep 2003 17:31:39 EDT Organization: SBC http://yahoo.sbc.com X-UserInfo1: Q[R_PJONGBWYR_LXIRHFJFTBTR\B@GXLN@GZ_GYO^ZWZUYICD^RA QBKZQTZTX\_I[^G_KGFNON[Z OE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ@CD^HKANYVW@RLGEZEJN@\_WZJBNZYYKVIOR]T]MNMG_ Z[YVWSCH_Q[GPC_A@CARQVXDSDA^M]@DRVUM@RBMDate: Tue, 02 Sep 2003 21:31:39 GMT Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onlin e.de!npeer.de.kpn-eurorings.net!in.100proofnews.com!in.100proofnews. com!prod igy.com!prodigy.com!newsmst01.news.prodigy.com!pr odigy.com!postmaster.news.p rodigy.com!newssvr25.news.prodigy.com.POSTED!fbab 4d1e!not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133630 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class.
Please see below.
'*********************************************** *************************** **' Issues '*********************************************** *************************** **
Note: 1. The abstract class (BaseRemoteDataObject) wants the derived classes to use it's ConnectString and DataRow properties' implementation, but requires the data manipulation methods to be overridden.
2. The interface that the clients will use (IPerson) allows access to the DataRow, but not the ConnectString. It also edxposes the data manipulation methods.
3. The public interface for the implementation class (Person) only allows Write access to the ConnectString (which IPerson doesn't recognize)
QUESTION: How do I map IPerson.DataRow() to BaseRemoteDataObject.DataRow through class Person.
In other words, I want BaseRemoteDataObject.DataRow to fulfill the IPerson.DataRow requirement in Person.DataRow.
Do I have to provide a pass through implementation for each method/property to mybase.property? Public Property DataRow() As System.Data.DataRow Implements IPerson.DataRow Get return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property
Am I making sense to anyone? TIA
'*********************************************** ***************************
**' Sample Code '*********************************************** *************************** **
MY ABSTRACT CLASS Public MustInherit Class BaseRemoteDataObject Inherits BaseRemoteObject Protected mstrConnectString As String Protected mDataRow As System.Data.DataRow
Public Property DataRow() As System.Data.DataRow Get Return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property Public Property ConnectString() As String Get Return mstrConnectString End Get Set(ByVal Value As String) mstrConnectString = Value End Set End Property
Public MustOverride Function CancelChanges() As Boolean Public MustOverride Function Clear() As Boolean Public MustOverride Function Retrieve(ByVal ID As Integer) As Integer Public MustOverride Function Save() As Integer End Class
MY INTERFACE Public Interface IPerson Event HasChanged(ByVal DataHasChanged As Boolean)
ReadOnly Property ID() As Int32 Property FirstName() As String Property LastName() As String ReadOnly Property IsChanged() As Boolean Property DataRow() As DataRow
Function Retrieve(ByVal ID As Int32) As Int32 Function Save() As Int32 Function Clear() As Boolean Function CancelChanges() As Boolean End Interface
MY IMPLEMENTATION Public Class Person Inherits BaseRemoteDataObject Implements IPerson Public Event HasChanged(ByVal DataHasChanged As Boolean) Implements IPerson.HasChanged
'Original Property Values Protected p_strFirstname As String Protected p_strLastname As String Protected p_intID As Int32
'Current Property Values Protected strFirstname As String Protected strLastname As String Protected intID As Int32
Protected blnChanged As Boolean
Public Shadows WriteOnly Property ConnectString() As String Set(ByVal Value As String) MyBase.mstrConnectString = Value End Set End Property
<< Most Code Omitted>>
End Class
Hi Ray,
I will do some research and update you with new information ASAP.
Have a nice day.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- From: Ray Dukes <rd****@emfbroadcasting.com> Newsgroups: microsoft.public.dotnet.languages.vb Subject: Re: HOWTO: Map interface declaration to a base class method? - TIA Message-ID: <gh********************************@4ax.com> References: <fm********************************@4ax.com>
<i#**************@cpmsftngxa06.phx.gbl>X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 221 NNTP-Posting-Host: 64.57.103.130 X-Complaints-To: ab***@prodigy.net X-Trace: newssvr25.news.prodigy.com 1062601764 ST000 64.57.103.130 (Wed,
03 Sep 2003 11:09:24 EDT)NNTP-Posting-Date: Wed, 03 Sep 2003 11:09:24 EDT Organization: SBC http://yahoo.sbc.com X-UserInfo1:
OX][R\KG\ZWOR^I]^JKBOW@@YJ_ZTB\MV@BZMVMHQAVTUZ]CLNTCPFK[WDXDHV[K^FCGJCJLPF_D
_NCC@FUG^Q\DINVAXSLIFXYJSSCCALP@PB@\OS@BITWAH\CQZK JMMD^SJA^NXA\GVLSRBD^M_NW_
F[YLVTWIGAXAQBOATKBBQRXECDFDMQ\DZFUE@\JMDate: Wed, 03 Sep 2003 15:09:24 GMT Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!skynet.be!skynet.be!newsgate.cistron.nl!amsne ws01.chello.com!in.100proo
fnews.com!in.100proofnews.com!prodigy.com!newsmst0 1.news.prodigy.com!prodigy
..com!postmaster.news.prodigy.com!newssvr25.news.p rodigy.com.POSTED!fbab4d1e!
not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133817 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
My question is this: When implementing an interface in a derived class, is there a way to map the interface method definition (Implements IPerson.DataRow) directly to the INHERITED function call, without having to provide an implementation in the derived class.
In other words, I want to map IPerson.DataRow to BaseRemoteDataObject.DataRow WITHOUT overriding with a new implementation in the Person class. I want the interface to use the inherited behavior, not redefine the behavior.
(I've seen nothing in the documentation that indicates that this is possible.)
Thanks very much for responding.
Ray Dukes
On Wed, 03 Sep 2003 08:14:16 GMT, v-******@online.microsoft.com (Peter Huang [MSFT]) wrote:
Hi Ray,
Please modifiy the DataRow Property in the ABSTRACT CLASS and MY IMPLEMENTATION as follows.
'MY ABSTRACT CLASS Public Overridable Property DataRow() As System.Data.DataRow Get Return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property
'MY IMPLEMENTATION Public Overrides Property DataRow() As DataRow Implements IPerson.DataRow Get DataRow = MyBase.DataRow End Get Set(ByVal Value As DataRow) MyBase.DataRow = Value End Set End Property
The Overrides keyword will inherit the DataRow property from the BaseRemoteDataObject class and it will implements IPerson.DataRow.
Did I misunderstand your meaning? If you have any further related question, please feel free to let me know.
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no
rights.--------------------From: Ray Dukes <rd****@emfbroadcasting.com> Newsgroups: microsoft.public.dotnet.languages.vb Subject: HOWTO: Map interface declaration to a base class method? - TIA Message-ID: <fm********************************@4ax.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 127 NNTP-Posting-Host: 64.57.103.130 X-Complaints-To: ab***@prodigy.net X-Trace: newssvr25.news.prodigy.com 1062538299 ST000 64.57.103.130 (Tue, 02 Sep 2003 17:31:39 EDT)NNTP-Posting-Date: Tue, 02 Sep 2003 17:31:39 EDT Organization: SBC http://yahoo.sbc.com X-UserInfo1: Q[R_PJONGBWYR_LXIRHFJFTBTR\B@GXLN@GZ_GYO^ZWZUYICD^RA QBKZQTZTX\_I[^G_KGFNON
[ZOE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ@CD^HKANYVW@RLGEZEJN@\_WZJBNZYYKVIOR]T]MNM
G_Z[YVWSCH_Q[GPC_A@CARQVXDSDA^M]@DRVUM@RBMDate: Tue, 02 Sep 2003 21:31:39 GMT Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfe ed00.sul.t-online.de!t-onl
ine.de!npeer.de.kpn-eurorings.net!in.100proofnews.com!in.100proofnews. com!pr
odigy.com!prodigy.com!newsmst01.news.prodigy.com!p rodigy.com!postmaster.news
..prodigy.com!newssvr25.news.prodigy.com.POSTED!fba b4d1e!not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133630 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class.
Please see below.
'********************************************** **************************
****' Issues '********************************************** **************************
****
Note: 1. The abstract class (BaseRemoteDataObject) wants the derived classes to use it's ConnectString and DataRow properties' implementation, but requires the data manipulation methods to be overridden.
2. The interface that the clients will use (IPerson) allows access to the DataRow, but not the ConnectString. It also edxposes the data manipulation methods.
3. The public interface for the implementation class (Person) only allows Write access to the ConnectString (which IPerson doesn't recognize)
QUESTION: How do I map IPerson.DataRow() to BaseRemoteDataObject.DataRow through class Person.
In other words, I want BaseRemoteDataObject.DataRow to fulfill the IPerson.DataRow requirement in Person.DataRow.
Do I have to provide a pass through implementation for each method/property to mybase.property? Public Property DataRow() As System.Data.DataRow Implements IPerson.DataRow Get return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property
Am I making sense to anyone? TIA
'********************************************** **************************
****' Sample Code '********************************************** **************************
****
MY ABSTRACT CLASS Public MustInherit Class BaseRemoteDataObject Inherits BaseRemoteObject Protected mstrConnectString As String Protected mDataRow As System.Data.DataRow
Public Property DataRow() As System.Data.DataRow Get Return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property Public Property ConnectString() As String Get Return mstrConnectString End Get Set(ByVal Value As String) mstrConnectString = Value End Set End Property
Public MustOverride Function CancelChanges() As Boolean Public MustOverride Function Clear() As Boolean Public MustOverride Function Retrieve(ByVal ID As Integer) As Integer Public MustOverride Function Save() As Integer End Class
MY INTERFACE Public Interface IPerson Event HasChanged(ByVal DataHasChanged As Boolean)
ReadOnly Property ID() As Int32 Property FirstName() As String Property LastName() As String ReadOnly Property IsChanged() As Boolean Property DataRow() As DataRow
Function Retrieve(ByVal ID As Int32) As Int32 Function Save() As Int32 Function Clear() As Boolean Function CancelChanges() As Boolean End Interface
MY IMPLEMENTATION Public Class Person Inherits BaseRemoteDataObject Implements IPerson Public Event HasChanged(ByVal DataHasChanged As Boolean) Implements IPerson.HasChanged
'Original Property Values Protected p_strFirstname As String Protected p_strLastname As String Protected p_intID As Int32
'Current Property Values Protected strFirstname As String Protected strLastname As String Protected intID As Int32
Protected blnChanged As Boolean
Public Shadows WriteOnly Property ConnectString() As String Set(ByVal Value As String) MyBase.mstrConnectString = Value End Set End Property
<< Most Code Omitted>>
End Class
Hi Ray,
Based on my experience, you can not I want to implement IPerson.DataRow by
mappting to the Base class without overriding with a new implementation in
the Person class.
You may do it as what I post in the last post.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- X-Tomcat-ID: 236409730 References: <fm********************************@4ax.com>
<i#**************@cpmsftngxa06.phx.gbl>
<gh********************************@4ax.com>MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: v-******@online.microsoft.com (Peter Huang [MSFT]) Organization: Microsoft Date: Thu, 04 Sep 2003 09:15:29 GMT Subject: Re: HOWTO: Map interface declaration to a base class method? - TIA X-Tomcat-NG: microsoft.public.dotnet.languages.vb Message-ID: <p3**************@cpmsftngxa06.phx.gbl> Newsgroups: microsoft.public.dotnet.languages.vb Lines: 240 Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:134106 NNTP-Posting-Host: TOMCATIMPORT2 10.201.218.182
Hi Ray,
I will do some research and update you with new information ASAP.
Have a nice day.
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. --------------------From: Ray Dukes <rd****@emfbroadcasting.com> Newsgroups: microsoft.public.dotnet.languages.vb Subject: Re: HOWTO: Map interface declaration to a base class method? -
TIAMessage-ID: <gh********************************@4ax.com> References: <fm********************************@4ax.com><i#**************@cpmsftngxa06.phx.gbl>X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 221 NNTP-Posting-Host: 64.57.103.130 X-Complaints-To: ab***@prodigy.net X-Trace: newssvr25.news.prodigy.com 1062601764 ST000 64.57.103.130 (Wed, 03 Sep 2003 11:09:24 EDT)NNTP-Posting-Date: Wed, 03 Sep 2003 11:09:24 EDT Organization: SBC http://yahoo.sbc.com X-UserInfo1: OX][R\KG\ZWOR^I]^JKBOW@@YJ_ZTB\MV@BZMVMHQAVTUZ]CLNTCPFK[WDXDHV[K^FCGJCJLPF_
D_NCC@FUG^Q\DINVAXSLIFXYJSSCCALP@PB@\OS@BITWAH\CQZ KJMMD^SJA^NXA\GVLSRBD^M_NW
_F[YLVTWIGAXAQBOATKBBQRXECDFDMQ\DZFUE@\JMDate: Wed, 03 Sep 2003 15:09:24 GMT Path:cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!skynet.be!skynet.be!newsgate.cistron.nl!amsn ews01.chello.com!in.100pro
ofnews.com!in.100proofnews.com!prodigy.com!newsmst 01.news.prodigy.com!prodig
y.com!postmaster.news.prodigy.com!newssvr25.news.p rodigy.com.POSTED!fbab4d1e
!not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133817 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
My question is this: When implementing an interface in a derived class, is there a way to map the interface method definition (Implements IPerson.DataRow) directly to the INHERITED function call, without having to provide an implementation in the derived class.
In other words, I want to map IPerson.DataRow to BaseRemoteDataObject.DataRow WITHOUT overriding with a new implementation in the Person class. I want the interface to use the inherited behavior, not redefine the behavior.
(I've seen nothing in the documentation that indicates that this is possible.)
Thanks very much for responding.
Ray Dukes
On Wed, 03 Sep 2003 08:14:16 GMT, v-******@online.microsoft.com (Peter Huang [MSFT]) wrote:
Hi Ray,
Please modifiy the DataRow Property in the ABSTRACT CLASS and MY IMPLEMENTATION as follows.
'MY ABSTRACT CLASS Public Overridable Property DataRow() As System.Data.DataRow Get Return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property
'MY IMPLEMENTATION Public Overrides Property DataRow() As DataRow Implements IPerson.DataRow Get DataRow = MyBase.DataRow End Get Set(ByVal Value As DataRow) MyBase.DataRow = Value End Set End Property
The Overrides keyword will inherit the DataRow property from the BaseRemoteDataObject class and it will implements IPerson.DataRow.
Did I misunderstand your meaning? If you have any further related question, please feel free to let me
know.
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.-------------------- From: Ray Dukes <rd****@emfbroadcasting.com> Newsgroups: microsoft.public.dotnet.languages.vb Subject: HOWTO: Map interface declaration to a base class method? - TIA Message-ID: <fm********************************@4ax.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 127 NNTP-Posting-Host: 64.57.103.130 X-Complaints-To: ab***@prodigy.net X-Trace: newssvr25.news.prodigy.com 1062538299 ST000 64.57.103.130
(Tue,02 Sep 2003 17:31:39 EDT) NNTP-Posting-Date: Tue, 02 Sep 2003 17:31:39 EDT Organization: SBC http://yahoo.sbc.com X-UserInfo1: Q[R_PJONGBWYR_LXIRHFJFTBTR\B@GXLN@GZ_GYO^ZWZUYICD^RA QBKZQTZTX\_I[^G_KGFNO
N[ZOE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ@CD^HKANYVW@RLGEZEJN@\_WZJBNZYYKVIOR]T]MN
MG_Z[YVWSCH_Q[GPC_A@CARQVXDSDA^M]@DRVUM@RBM Date: Tue, 02 Sep 2003 21:31:39 GMT Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsf eed00.sul.t-online.de!t-on
line.de!npeer.de.kpn-eurorings.net!in.100proofnews.com!in.100proofnews. com!p
rodigy.com!prodigy.com!newsmst01.news.prodigy.com! prodigy.com!postmaster.new
s.prodigy.com!newssvr25.news.prodigy.com.POSTED!fb ab4d1e!not-for-mail Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:133630 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class.
Please see below.
'********************************************* **************************
***** ' Issues '********************************************* **************************
*****
Note: 1. The abstract class (BaseRemoteDataObject) wants the derived classes to use it's ConnectString and DataRow properties' implementation, but requires the data manipulation methods to be overridden.
2. The interface that the clients will use (IPerson) allows access to the DataRow, but not the ConnectString. It also edxposes the data manipulation methods.
3. The public interface for the implementation class (Person) only allows Write access to the ConnectString (which IPerson doesn't recognize)
QUESTION: How do I map IPerson.DataRow() to BaseRemoteDataObject.DataRow through class Person.
In other words, I want BaseRemoteDataObject.DataRow to fulfill the IPerson.DataRow requirement in Person.DataRow.
Do I have to provide a pass through implementation for each method/property to mybase.property? Public Property DataRow() As System.Data.DataRow Implements IPerson.DataRow Get return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property
Am I making sense to anyone? TIA
'********************************************* **************************
***** ' Sample Code '********************************************* **************************
*****
MY ABSTRACT CLASS Public MustInherit Class BaseRemoteDataObject Inherits BaseRemoteObject Protected mstrConnectString As String Protected mDataRow As System.Data.DataRow
Public Property DataRow() As System.Data.DataRow Get Return mDataRow End Get Set(ByVal Value As System.Data.DataRow) mDataRow = Value End Set End Property Public Property ConnectString() As String Get Return mstrConnectString End Get Set(ByVal Value As String) mstrConnectString = Value End Set End Property
Public MustOverride Function CancelChanges() As Boolean Public MustOverride Function Clear() As Boolean Public MustOverride Function Retrieve(ByVal ID As Integer) As Integer Public MustOverride Function Save() As Integer End Class
MY INTERFACE Public Interface IPerson Event HasChanged(ByVal DataHasChanged As Boolean)
ReadOnly Property ID() As Int32 Property FirstName() As String Property LastName() As String ReadOnly Property IsChanged() As Boolean Property DataRow() As DataRow
Function Retrieve(ByVal ID As Int32) As Int32 Function Save() As Int32 Function Clear() As Boolean Function CancelChanges() As Boolean End Interface
MY IMPLEMENTATION Public Class Person Inherits BaseRemoteDataObject Implements IPerson Public Event HasChanged(ByVal DataHasChanged As Boolean) Implements IPerson.HasChanged
'Original Property Values Protected p_strFirstname As String Protected p_strLastname As String Protected p_intID As Int32
'Current Property Values Protected strFirstname As String Protected strLastname As String Protected intID As Int32
Protected blnChanged As Boolean
Public Shadows WriteOnly Property ConnectString() As String Set(ByVal Value As String) MyBase.mstrConnectString = Value End Set End Property
<< Most Code Omitted>>
End Class
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
3 posts
views
Thread by Kannan |
last post: by
|
6 posts
views
Thread by Alex Sedow |
last post: by
|
20 posts
views
Thread by Ole Hanson |
last post: by
|
9 posts
views
Thread by phl |
last post: by
|
15 posts
views
Thread by jon |
last post: by
|
7 posts
views
Thread by moondaddy |
last post: by
|
2 posts
views
Thread by fred |
last post: by
|
5 posts
views
Thread by The Cool Giraffe |
last post: by
|
13 posts
views
Thread by Ben Voigt [C++ MVP] |
last post: by
| | | | | | | | | | |