473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

protected modifier for a class

Hello

What does mean when a protected modifier is apllied to a class.

I want to inherit a protected class defined in another class, I saw that the
microsoft programmers achieved that.
But I cannot ( ex.I want to inherit the protected abstract class
CollectionForm that is defined in the CollectionEditor class but I don't
achieve this). Any suggestions?

Regards
Dan Cimpoiesu
Nov 15 '05 #1
2 6456


HI,

If you are interested in inhering from an abstract class,

use the following guidelines.

public class MyCar : Car
{
public override void GoForward(int I)
{
// Specific implementation of this method would go here
}
public override int CheckSpeed()
{
// Implementation for this method goes here
}
public override string Color
{
get
{
// Both the getter and the setter must be implemented
}
set
{
// Setter implementation goes here
}
}
}
Also, are you referening the target library
(i.e. using System.xxx)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #2
Thanks for the answer, but I was asking something else.
I found the answer myself though.

I figure the following situation

Existing class

public class A
{
protected class InnerA
{
}
}

and I want to inherit the class InnerA

I found the following solution

public class B : A
{
protected class InnerB : A.InnerA
{
}
}

Note. the modifier for the class InnerB must be weaker than the modifier for
B that means private or protected.

So the conclusion is that a class marked as protected and that is declared
in another class, can be inherited only in a inherited class of the
containing class. :))
Anyway it seems that the Intellisense feature of the VS IDE does not know
this trick.

Regards
Dan Cimpoiesu


"VIpul" <vi*********@patni.com.spam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...


HI,

If you are interested in inhering from an abstract class,

use the following guidelines.

public class MyCar : Car
{
public override void GoForward(int I)
{
// Specific implementation of this method would go here
}
public override int CheckSpeed()
{
// Implementation for this method goes here
}
public override string Color
{
get
{
// Both the getter and the setter must be implemented
}
set
{
// Setter implementation goes here
}
}
}
Also, are you referening the target library
(i.e. using System.xxx)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: AIK | last post by:
I have the following two classes: package birdpack; public class Bird { Bird() {} protected int nFeathers;
2
by: BobReynolds | last post by:
We use Log4j for all our logging, I want to know why we have to do the following in EVERY class final private static org.apache.log4j.Logger log = LoggerUtil.getLogger(thisClassName.class); ...
5
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.) ...
12
by: Chris | last post by:
Hi I am trying to create a base class with the Protected keyword Protected MustInherit Class MyBaseClas .. .. End Clas And I got an error saying something like the Protected keyword...
3
by: gordon | last post by:
can someone please explain what protected override void is ? what is it used for? thanks Doug
4
by: aaryan | last post by:
hi all, again i need a clarification. the access modifier protected means that class members are accessible from its own class and its derived class only. internal means that the class member is...
13
by: Clive Dixon | last post by:
I am refactoring some code to move some base classes into a separate assembly. One of these base classes has a member property which is 'protected internal'. However when I move these base classes...
13
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,...
8
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.