Protected access modifier in Struct

S

Stephen

Hi,

Please do tell me why i cant have a protected access modifier in a struct?
i get this error

namespace StructExample
{
class Tester
{
static void Main(string[] args)
{
//instance of struct
}
}

internal struct Location
{
protected Location(int xCoordinate, int yCoordinate, int StatusValue)
{
//initialization
}
}
}

"StructExample.Location.Location(int, int, int)' : new protected member
declared in struct" -- Error Message


Thanks,
Stephen
 
K

Karl Seguin [MVP]

Structure members can't be protected because you cannot inherit from a
struct...doesn't make sense why you'd do it, so they don't let you.

Karl
 
S

Stephen

Thanks Karl

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:OQ%[email protected]...
Structure members can't be protected because you cannot inherit from a
struct...doesn't make sense why you'd do it, so they don't let you.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


Stephen said:
Hi,

Please do tell me why i cant have a protected access modifier in a struct?
i get this error

namespace StructExample
{
class Tester
{
static void Main(string[] args)
{
//instance of struct
}
}

internal struct Location
{
protected Location(int xCoordinate, int yCoordinate, int StatusValue)
{
//initialization
}
}
}

"StructExample.Location.Location(int, int, int)' : new protected member
declared in struct" -- Error Message


Thanks,
Stephen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top