Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Serviced Component: Can't override Construct Method in RTM?

0 views
Skip to first unread message

Peter Bromberg

unread,
Jan 27, 2002, 1:27:48 PM1/27/02
to
This sample code is from Beta 2. The new RTM Docs say you can override the
Construct Method:

"This method is called by the infrastructure just after the constructor is
called,
passing in the constructor string. Override this method to make use of the
construction string value."

However, the code as shown raises a compiler error:

" cannot change access modifiers when overriding 'protected' inherited
member 'System.EnterpriseServices.ServicedComponent.Construct(string)"

Anybody maybe can provide insight on this?

// Sample code:


public class Book : ServicedComponent

{

private string mConnString;

public Book()

{


}

// couldn't use override here - change from BETA 2??

public override void Construct(string s)

{

mConnString=s;

}

Tomas Restrepo [MVP]

unread,
Jan 27, 2002, 1:39:17 PM1/27/02
to
Peter,

The problem is not in the override, it's that you maked Construct public,
while it is protected in ServicedComponent. Just change the line above to:
protected override void Construct(string s)

And it should work.

--
Tomas Restrepo
tom...@mvps.org


Peter Bromberg

unread,
Jan 27, 2002, 2:11:57 PM1/27/02
to
Thanks Tomas! <sheepish grin/>

"Tomas Restrepo [MVP]" <tom...@mvps.org> wrote in message
news:OpLh1H2pBHA.1964@tkmsftngp07...

0 new messages