473,395 Members | 1,343 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,395 software developers and data experts.

Inheritance - Modifiers property

Hello,

I just finished an online tutorial regarding Visual
Inheritance. It was very informative, despite the fact
that I am still unclear on two of the settings for the
Modifiers property.

I understand how to use the Private & Public settings, but
became confused on the purpose of the Protected & Friend
settings.

Could anyone please explain why I would use these instead
of Private & Public?

Thanks in Advance,
Chris Adams
Nov 20 '05 #1
7 1128
Private members (properties, methods, and fields) can only be used by the
class that contains them.
Protected members can be used by classes that inherit the class that
contains them. For example, if you create a base form (MyBaseForm), and you
then you create a MySummaryDialog that inherits MyBaseForm, then
MySummaryDialog can see and use the MyBaseForm protected members, but other
classes that don't inherit MyBaseForm cannot.
Friend members can be used by any class as long as the classes are inside
the same project.

-Rob Teixeira [MVP]

"Chris Adams" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
Hello,

I just finished an online tutorial regarding Visual
Inheritance. It was very informative, despite the fact
that I am still unclear on two of the settings for the
Modifiers property.

I understand how to use the Private & Public settings, but
became confused on the purpose of the Protected & Friend
settings.

Could anyone please explain why I would use these instead
of Private & Public?

Thanks in Advance,
Chris Adams

Nov 20 '05 #2
Rob Teixeira [MVP] wrote:
Private members (properties, methods, and fields) can only be used by
the class that contains them.
Protected members can be used by classes that inherit the class that
contains them. For example, if you create a base form (MyBaseForm),
and you then you create a MySummaryDialog that inherits MyBaseForm,
then MySummaryDialog can see and use the MyBaseForm protected
members, but other classes that don't inherit MyBaseForm cannot.
Friend members can be used by any class as long as the classes are
Also, For non nested classes, Public Members, have the scope the entire
application
provided that the access level is not limited by the Access level of the
class itself

-Rob Teixeira [MVP]

"Chris Adams" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
Hello,

I just finished an online tutorial regarding Visual
Inheritance. It was very informative, despite the fact
that I am still unclear on two of the settings for the
Modifiers property.

I understand how to use the Private & Public settings, but
became confused on the purpose of the Protected & Friend
settings.

Could anyone please explain why I would use these instead
of Private & Public?

Thanks in Advance,
Chris Adams


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #3
Cor
Hi OHM,

Do you not have a HKW connector?

Cor
Nov 20 '05 #4
In addition, "Protected Friend" members have the access level of "Protected"
members and "Friend" members (They can be accessed by derived classes in any
project and by any other class in the same project)

HTH,

Trev.
Nov 20 '05 #5
* "Cor" <no*@non.com> scripsit:
Do you not have a HKW connector?


Why?!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Cor
Oops Wrong Thread
Do you not have a HKW connector?

Why?!


:-)) ))) USB port was probably out

Nov 20 '05 #7
WTF ??

Cor wrote:
Hi OHM,

Do you not have a HKW connector?

Cor


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #8

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

Similar topics

4
by: Laurence Nuttall | last post by:
What is the modifiers property of a label mean? I looked in the help, but couldn't find any explantion for it. Thanks in Advance, Laurence Nuttall Programmer Analyst III
8
by: __PPS__ | last post by:
Hello everybody, today I had another quiz question "if class X is privately derived from base class Y what is the scope of the public, protected, private members of Y will be in class X" By...
20
by: Steve Jorgensen | last post by:
A while back, I started boning up on Software Engineering best practices and learning about Agile programming. In the process, I've become much more committed to removing duplication in code at a...
14
by: Steve Jorgensen | last post by:
Recently, I tried and did a poor job explaining an idea I've had for handling a particular case of implementation inheritance that would be easy and obvious in a fully OOP language, but is not at...
2
by: Bob Weiner | last post by:
Is it possible to create a property and specify different access modifiers for the get and set methods? From the property definition it appears that you can define attributes but not access...
3
by: Francois | last post by:
Hi, I am trying to extend a .NET class for overriding some methods. The class that I try to override is : System.Web.UI.WebControls.CheckBox. Its full definition is : public class CheckBox :...
45
by: Ben Blank | last post by:
I'm writing a family of classes which all inherit most of their methods and code (including constructors) from a single base class. When attempting to instance one of the derived classes using...
2
by: Kay Schluehr | last post by:
The problem of unintended inheritance is typical for OO frameworks and can be explained as follows. Given a class Foo implemented by Alice and a derived class Bar of Foo implemented by Bob. Bar...
1
by: leorochab | last post by:
Hi all, I am in trouble with visual inheritance in VS 2005, using C#. I canīt inherit any container control. They appear with a padlock, even setting the "MODIFIERS" property (PUBLIC/PROTECTED)...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.