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 2 1530
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" <st********@hotmail.com> wrote in message
news:Oa**************@TK2MSFTNGP05.phx.gbl... 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
Thanks Karl
"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:OQ****************@TK2MSFTNGP04.phx.gbl... 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" <st********@hotmail.com> wrote in message news:Oa**************@TK2MSFTNGP05.phx.gbl... 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: AIK |
last post by:
I have the following two classes:
package birdpack;
public class Bird {
Bird() {}
protected int nFeathers;
|
by: Hin |
last post by:
from MSDN, decription for protected internal is
"Access is limited to the current project OR types derived from the containing
class"
Is there any way i can have the access limited to the...
|
by: Chua Wen Ching |
last post by:
Hi there,
I had seen examples for classes, but i had no idea how to implement the same
thing in struct. I am quite mix up!
Which one is correct?
Scenario:
WForm.cs - the one that calls...
|
by: Nathan Wiegman |
last post by:
Hi,
Why must derived classes access protected base members through an instance
of a derived class? The following code would work in C++, why doesn't it in
C#?
public class A
{
protected...
|
by: Kolozs, Áron |
last post by:
Hi everybody,
The C# compiler reports a Compiler Error CS0052 in the following situation:
I declared a type marked as "internal":
namespace MyNamespace
{
internal class MyInteralClass
|
by: |
last post by:
hello there,
what is the difference between Shared and Protected
Shared? where can I read more about theses kind of
variables (or whatever they are....sorry, don't know the
word in eng.)
...
|
by: Fir5tSight |
last post by:
Hi All,
I have a small C#.NET program that is as follows:
using System;
class A
{
protected int x = 123;
}
|
by: Tom Baxter |
last post by:
Hi everyone,
Has anyone looked at section 18.1.1 of the C# spec? It indicates 'new' and
'protected' are valid modifiers on struct declarations. First, how can
'protected' be valid on a struct,...
|
by: Mayur H Chauhan |
last post by:
All,
For my knowledge, if I declare Class as follow, then it thows
compilation error.
Protected Class Book
End Class
Even same for...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
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...
| |