Re: Error: More than one protection modifier

Peter Ritchie <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <LISTSERV%[email protected]>
Hi Peter.

I had to add the following member to the ValueItem class in order to get
it to compile:
  IoChannelTypeOption _ioChannelType;

But, I did not get an error CS0107.  There must be something else that
causing this that you did not provide with the posted code.

On Fri, 8 Sep 2006 14:28:31 -0400, Peter Osucha
<[email protected]> wrote:

>Yeah, strange, imo.  That's all I could get when looking at the docs
>concerning that error.  The abstract classes are pretty simple...
>
>Below is the code for the classes (absA - ValueItem, absB = IoChannel).
The
>error shows up at compile time with the first ValueItem constructor
>highlighted.
>
>    public abstract class ValueItem
>    {
>        private string _name;
>        private string _key;
>        private string _ioChannelKey;
>
>        public ValueItem ( string Key, string Name ) // this is where the
>error highlight is
>        {
>            _key = Key;
>            _name = Name;
>        }
>
>        public ValueItem ( string Key, string Name, string IoChannelKey )
>        {
>            _key = Key;
>            _name = Name;
>            _ioChannelKey = IoChannelKey;
>        }
>        public string IoChannelKey { get { return _ioChannelKey; } set {
>_ioChannelKey = value; } }
>        public string Name { get { return _name; } set { _name =
value; } }
>        public string Key { get { return _key; } }
>        public IoChannelTypeOption IoChannelType { get { return
>_ioChannelType; } set { _ioChannelType = value; } }
>    }
>
>    public abstract class IoChannel
>    {
>        private string _key;
>        private string _name;
>        private int _index;
>        private int _summaryIndex;
>        private int _boardNum;
>        private IoBoardSystemOption _ioBoardSystem;
>        private IoChannelTypeOption _ioChannelType;
>        private IoManager _ioManager;
>
>        public IoChannel ( string Key, string Name, int Index, int
BoardNum,
>IoBoardSystemOption IoBoardSystem, IoChannelTypeOption IoChannelType,
>IoManager IoManager )
>        {
>            _key = Key;
>            _name = Name;
>            _index = Index;
>            _boardNum = BoardNum;
>            _ioBoardSystem = IoBoardSystem;
>            _ioChannelType = IoChannelType;
>            _ioManager = IoManager;
>        }
>
>        public string Key { get { return _key; } }
>        public string Name { get { return _name; } set { _name =
value; } }
>        public int Index { get { return _index; } set { _index =
value; } }
>        public int SummaryIndex { get { return _summaryIndex; } set {
>_summaryIndex = value; } }
>        public int BoardNum { get { return _boardNum; } set { _boardNum =
>value; } }
>        public IoBoardSystemOption IoBoardSystem { get { return
>_ioBoardSystem; } set { _ioBoardSystem = value; }
>        public IoManager IoManager { get { return _ioManager; } set {
>_ioManager = value; } }
>        public IoChannelTypeOption IoChannelType { get { return
>_ioChannelType; } set { _ioChannelType = value; } }
>    }
>
>> -----Original Message-----
>> From: Discussion relating to the specifics of the C# and
>> Managed C++ languages [mailto:[email protected]]
>> On Behalf Of Peter Ritchie
>> Sent: Friday, September 08, 2006 2:06 PM
>> To: [email protected]
>> Subject: Re: [DOTNET-CX] Error: More than one protection modifier
>>
>> You're getting a CS0107 error "More than one protection modifier"?
>>
>> Can you post the classes in question and point out the exact
>> line you've having the problem?  You're supposed to get this
>> error if you define a member with more than one protection
>> modifier.  For example, the following is bad:
>>
>> public protected void Method(){}
>>
>> On Fri, 8 Sep 2006 14:00:55 -0400, Peter Osucha
>> <[email protected]> wrote:
>>
>> >I have two abstract classes in a project (absA and absB).  I
>> have two
>> >derived classes from absA (absADerived1, absADerived2) and two from
>> >absB (absBDerived1, absBDerived2).
>> >
>> >In a class that uses objects of all 4 derived types, I have two
>> >methods;
>> the
>> >first (methA) takes an object of type absA and the second (methB) of
>> >type absB.
>> >
>> >When I want to call methA, I do so with something like...
>> >
>> >absADerived1 = new absADerived1();
>> >methA( (absA) absADerived1);
>> >
>> >This 'cast' seems to work fine.
>> >
>> >However, when I am trying to do the same thing with methB, ie...
>> >
>> >absBDerived1 = new absBDerived1();
>> >methB( (absB) absBDerived1);
>> >
>> >I am getting the error shown in the subject of this email in
>> class absB
>> (on
>> >a constructor if that helps at all).
>> >
>> >the abstract classes absA and absB are virtually identical
>> and there is
>> not
>> >more than one protection modifier.  I figure the real error is
>> >something else but I can't anything in MSDN on it.  Anyone know what
>> >might cause
>> this
>> >problem?

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.