473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HOWTO: Map interface declaration to a base class method? - TIA

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
Nov 20 '05 #1
4 2828
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


Nov 20 '05 #2
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@RBM
Date: 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-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


Nov 20 '05 #3
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@RBM
Date: 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-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



Nov 20 '05 #4
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? - 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\CQZ KJMMD^SJA^NXA\GVLSRBD^M_NW _F[YLVTWIGAXAQBOATKBBQRXECDFDMQ\DZFUE@\JM
Date: 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-mail
Xref: 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
M
G_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
l
ine.de!npeer.de.kpn-eurorings.net!in.100proofnews.com!in.100proofnews. com!p
r
odigy.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




Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kannan | last post by:
hi My question might be a simple questions. I am doing C# maintanance project I have seen so many places Interface is used in my main class. But I could't not understan what is the use of...
6
by: Alex Sedow | last post by:
Example 1 interface I { string ToString(); } public class C : I { public void f() {
20
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the...
9
by: phl | last post by:
hi, I am kind of confused aobut interfaces and abstract classes. In short as I understand it, an interface is like a contract between the class and the interface, so that certain funtions must...
15
by: jon | last post by:
How can I call a base interface method? class ThirdPartyClass :IDisposable { //I can not modify this class void IDisposable.Dispose() { Console.WriteLine( "ThirdPartyClass Dispose" ); } } ...
7
by: moondaddy | last post by:
If I'm in a class that inherits an interface, is there a shortcut key that will write the implementation of the interface into the class? I remember seeing something like this in vb.net. ...
2
by: fred | last post by:
Hi, Why should I do a cast (IOfferSetter) in the constructor of the Test class? Thanks. Fred public interface IOfferSetter { object Offer { set;} } public class OfferCtx {
5
by: The Cool Giraffe | last post by:
I'm designing an ABC and in connection to that i have run into some "huh!" and "oh...". Let me put it as a list. 1. Since the class will only contain bodies of the methods, only the header file...
13
by: Ben Voigt [C++ MVP] | last post by:
This is more of a C# question than a C++ question, but my best chance of explaining it is via comparison to C++. Ok: In C++ you can forward declare a type. Then references to that type can be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.