By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,769 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,769 IT Pros & Developers. It's quick & easy.

Question on inheritance.

P: n/a
I am playing with classes and got the following error:

c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004: variable
'Se
ssionKey' conflicts with variable 'SessionKey' in the base class
'AuthHeader' an
d so should be declared 'Shadows'.

Public SessionKey As String
~~~~~~~~~~

Now the Classes I have are:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:ServiceTicket
Public TomsClass1Name As String
End Class
**************************************

If I comment out the TempClass1, it works fine:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

'Public Class TempClass1:ServiceTicket
' Public TomsClass1Name As String
'End Class
****************************************

Why doesn't the SessionKey in "ServiceTicket", conflict with the SessionKey
in AuthHeader?

Thanks,

Tom
Apr 3 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Hi,

This is a C# group, yours is a VB.net question.

your problem is that one of the classes you inherit from declare a
SessionKey variable, so yours collide with the other.
Solution;
Simply rename your variable and use another name.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
I am playing with classes and got the following error:

c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
variable 'Se
ssionKey' conflicts with variable 'SessionKey' in the base class
'AuthHeader' an
d so should be declared 'Shadows'.

Public SessionKey As String
~~~~~~~~~~

Now the Classes I have are:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:ServiceTicket
Public TomsClass1Name As String
End Class
**************************************

If I comment out the TempClass1, it works fine:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

'Public Class TempClass1:ServiceTicket
' Public TomsClass1Name As String
'End Class
****************************************

Why doesn't the SessionKey in "ServiceTicket", conflict with the
SessionKey in AuthHeader?

Thanks,

Tom

Apr 3 '06 #2

P: n/a
It does for me even after I comment TempClass1... I am on 1.1 with VS.NET
2003

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
I am playing with classes and got the following error:

c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
variable 'Se
ssionKey' conflicts with variable 'SessionKey' in the base class
'AuthHeader' an
d so should be declared 'Shadows'.

Public SessionKey As String
~~~~~~~~~~

Now the Classes I have are:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:ServiceTicket
Public TomsClass1Name As String
End Class
**************************************

If I comment out the TempClass1, it works fine:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

'Public Class TempClass1:ServiceTicket
' Public TomsClass1Name As String
'End Class
****************************************

Why doesn't the SessionKey in "ServiceTicket", conflict with the
SessionKey in AuthHeader?

Thanks,

Tom

Apr 3 '06 #3

P: n/a
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

This is a C# group, yours is a VB.net question. You're right.

I have been going back and forth between VB.Net and C# and wasn't paying
attention.

I also found the problem was that I was missing the word "Inherits" in the
TempClass1 declaration.

Thanks,

Tom
your problem is that one of the classes you inherit from declare a
SessionKey variable, so yours collide with the other.
Solution;
Simply rename your variable and use another name.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
I am playing with classes and got the following error:

c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
variable 'Se
ssionKey' conflicts with variable 'SessionKey' in the base class
'AuthHeader' an
d so should be declared 'Shadows'.

Public SessionKey As String
~~~~~~~~~~

Now the Classes I have are:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:ServiceTicket
Public TomsClass1Name As String
End Class
**************************************

If I comment out the TempClass1, it works fine:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

'Public Class TempClass1:ServiceTicket
' Public TomsClass1Name As String
'End Class
****************************************

Why doesn't the SessionKey in "ServiceTicket", conflict with the
SessionKey in AuthHeader?

Thanks,

Tom


Apr 3 '06 #4

P: n/a
"Vijay" <vi***@msdiscussions.com> wrote in message
news:O6**************@TK2MSFTNGP15.phx.gbl...
It does for me even after I comment TempClass1... I am on 1.1 with VS.NET
2003
As I mentioned above, I forgot the Inherits keyword and didn't wasn't paying
attention to language (VB.Net) and the newsgroup.

Thanks,

Tom
Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
I am playing with classes and got the following error:

c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
variable 'Se
ssionKey' conflicts with variable 'SessionKey' in the base class
'AuthHeader' an
d so should be declared 'Shadows'.

Public SessionKey As String
~~~~~~~~~~

Now the Classes I have are:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:ServiceTicket
Public TomsClass1Name As String
End Class
**************************************

If I comment out the TempClass1, it works fine:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

'Public Class TempClass1:ServiceTicket
' Public TomsClass1Name As String
'End Class
****************************************

Why doesn't the SessionKey in "ServiceTicket", conflict with the
SessionKey in AuthHeader?

Thanks,

Tom


Apr 3 '06 #5

P: n/a
I understand.. very similar to you I juggle VB/C# very much...in a given
week

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Vijay" <vi***@msdiscussions.com> wrote in message
news:O6**************@TK2MSFTNGP15.phx.gbl...
It does for me even after I comment TempClass1... I am on 1.1 with VS.NET
2003


As I mentioned above, I forgot the Inherits keyword and didn't wasn't
paying attention to language (VB.Net) and the newsgroup.

Thanks,

Tom

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
I am playing with classes and got the following error:

c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
variable 'Se
ssionKey' conflicts with variable 'SessionKey' in the base class
'AuthHeader' an
d so should be declared 'Shadows'.

Public SessionKey As String
~~~~~~~~~~

Now the Classes I have are:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:ServiceTicket
Public TomsClass1Name As String
End Class
**************************************

If I comment out the TempClass1, it works fine:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

'Public Class TempClass1:ServiceTicket
' Public TomsClass1Name As String
'End Class
****************************************

Why doesn't the SessionKey in "ServiceTicket", conflict with the
SessionKey in AuthHeader?

Thanks,

Tom



Apr 3 '06 #6

P: n/a
Yes,

I typically write my Asp.Net code in VB.Net, but I like to use C# to build
my classes because it is really convenient for naming.

I use camel case for my private variables: firstName, lastName.

I then use Pascal Case for my Properties: FirstName, LastName.

Makes it easy to differentiate the variables and I don't need to use
underscores, as others do.

Tom

"Vijay" <vi***@msdiscussions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I understand.. very similar to you I juggle VB/C# very much...in a given
week

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Vijay" <vi***@msdiscussions.com> wrote in message
news:O6**************@TK2MSFTNGP15.phx.gbl...
It does for me even after I comment TempClass1... I am on 1.1 with
VS.NET 2003


As I mentioned above, I forgot the Inherits keyword and didn't wasn't
paying attention to language (VB.Net) and the newsgroup.

Thanks,

Tom

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
I am playing with classes and got the following error:

c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
variable 'Se
ssionKey' conflicts with variable 'SessionKey' in the base class
'AuthHeader' an
d so should be declared 'Shadows'.

Public SessionKey As String
~~~~~~~~~~

Now the Classes I have are:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

Public Class TempClass1:ServiceTicket
Public TomsClass1Name As String
End Class
**************************************

If I comment out the TempClass1, it works fine:
***************************************
Public Class AuthHeader:Inherits SoapHeader
Public SessionKey As String
End Class

Public Class ServiceTicket:Inherits AuthHeader
Public IsAuthenticated As Boolean
Public SessionKey As String
Public Expiration As DateTime
End Class

'Public Class TempClass1:ServiceTicket
' Public TomsClass1Name As String
'End Class
****************************************

Why doesn't the SessionKey in "ServiceTicket", conflict with the
SessionKey in AuthHeader?

Thanks,

Tom



Apr 3 '06 #7

P: n/a
just curious why do you use VB.NET with ASP.NET?.. isn't C# better to use in
ASP.NET?

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OU**************@TK2MSFTNGP14.phx.gbl...
Yes,

I typically write my Asp.Net code in VB.Net, but I like to use C# to build
my classes because it is really convenient for naming.

I use camel case for my private variables: firstName, lastName.

I then use Pascal Case for my Properties: FirstName, LastName.

Makes it easy to differentiate the variables and I don't need to use
underscores, as others do.

Tom

"Vijay" <vi***@msdiscussions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I understand.. very similar to you I juggle VB/C# very much...in a given
week

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Vijay" <vi***@msdiscussions.com> wrote in message
news:O6**************@TK2MSFTNGP15.phx.gbl...
It does for me even after I comment TempClass1... I am on 1.1 with
VS.NET 2003

As I mentioned above, I forgot the Inherits keyword and didn't wasn't
paying attention to language (VB.Net) and the newsgroup.

Thanks,

Tom

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
>I am playing with classes and got the following error:
>
> c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
> variable 'Se
> ssionKey' conflicts with variable 'SessionKey' in the base class
> 'AuthHeader' an
> d so should be declared 'Shadows'.
>
> Public SessionKey As String
> ~~~~~~~~~~
>
> Now the Classes I have are:
> ***************************************
> Public Class AuthHeader:Inherits SoapHeader
> Public SessionKey As String
> End Class
>
> Public Class ServiceTicket:Inherits AuthHeader
> Public IsAuthenticated As Boolean
> Public SessionKey As String
> Public Expiration As DateTime
> End Class
>
> Public Class TempClass1:ServiceTicket
> Public TomsClass1Name As String
> End Class
> **************************************
>
> If I comment out the TempClass1, it works fine:
> ***************************************
> Public Class AuthHeader:Inherits SoapHeader
> Public SessionKey As String
> End Class
>
> Public Class ServiceTicket:Inherits AuthHeader
> Public IsAuthenticated As Boolean
> Public SessionKey As String
> Public Expiration As DateTime
> End Class
>
> 'Public Class TempClass1:ServiceTicket
> ' Public TomsClass1Name As String
> 'End Class
> ****************************************
>
> Why doesn't the SessionKey in "ServiceTicket", conflict with the
> SessionKey in AuthHeader?
>
> Thanks,
>
> Tom
>



Apr 3 '06 #8

P: n/a
"Vijay" <vi***@msdiscussions.com> wrote in message
news:OG**************@TK2MSFTNGP09.phx.gbl...
just curious why do you use VB.NET with ASP.NET?.. isn't C# better to use
in ASP.NET?
Actually, no.

They are essentially the same. I assume there are some disagreements, but
as far as I have read, there really is no real difference between the 2
(other than syntax). I am sure there are some, but I think for most of the
everyday use - this is not the case.

I actually am a C programmer (have been for about 10 years) and decided to
build our site with VB.Net because of the lack of differences and I wanted
to learn something different. This would not have been the case before
VB.Net. I would never have done VB6 instead of C++.

As I mentioned, I do prefer C# for building Classes ( I am not talking about
Asp.Net pages, which are also Classes).

Tom
Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OU**************@TK2MSFTNGP14.phx.gbl...
Yes,

I typically write my Asp.Net code in VB.Net, but I like to use C# to
build my classes because it is really convenient for naming.

I use camel case for my private variables: firstName, lastName.

I then use Pascal Case for my Properties: FirstName, LastName.

Makes it easy to differentiate the variables and I don't need to use
underscores, as others do.

Tom

"Vijay" <vi***@msdiscussions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I understand.. very similar to you I juggle VB/C# very much...in a given
week

Vijay

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Vijay" <vi***@msdiscussions.com> wrote in message
news:O6**************@TK2MSFTNGP15.phx.gbl...
> It does for me even after I comment TempClass1... I am on 1.1 with
> VS.NET 2003

As I mentioned above, I forgot the Inherits keyword and didn't wasn't
paying attention to language (VB.Net) and the newsgroup.

Thanks,

Tom
>
> Vijay
>
> "tshad" <ts**********@ftsolutions.com> wrote in message
> news:eB**************@TK2MSFTNGP09.phx.gbl...
>>I am playing with classes and got the following error:
>>
>> c:\inetpub\wwwroot\hello\SecureService.asmx(135) : warning BC40004:
>> variable 'Se
>> ssionKey' conflicts with variable 'SessionKey' in the base class
>> 'AuthHeader' an
>> d so should be declared 'Shadows'.
>>
>> Public SessionKey As String
>> ~~~~~~~~~~
>>
>> Now the Classes I have are:
>> ***************************************
>> Public Class AuthHeader:Inherits SoapHeader
>> Public SessionKey As String
>> End Class
>>
>> Public Class ServiceTicket:Inherits AuthHeader
>> Public IsAuthenticated As Boolean
>> Public SessionKey As String
>> Public Expiration As DateTime
>> End Class
>>
>> Public Class TempClass1:ServiceTicket
>> Public TomsClass1Name As String
>> End Class
>> **************************************
>>
>> If I comment out the TempClass1, it works fine:
>> ***************************************
>> Public Class AuthHeader:Inherits SoapHeader
>> Public SessionKey As String
>> End Class
>>
>> Public Class ServiceTicket:Inherits AuthHeader
>> Public IsAuthenticated As Boolean
>> Public SessionKey As String
>> Public Expiration As DateTime
>> End Class
>>
>> 'Public Class TempClass1:ServiceTicket
>> ' Public TomsClass1Name As String
>> 'End Class
>> ****************************************
>>
>> Why doesn't the SessionKey in "ServiceTicket", conflict with the
>> SessionKey in AuthHeader?
>>
>> Thanks,
>>
>> Tom
>>
>
>



Apr 3 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.