473,405 Members | 2,445 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,405 software developers and data experts.

Class Access Modifiers

Can anybody let me know the difference between public and private class
access modifiers? Thanks in advance
Jul 21 '05 #1
3 1723

"kchalla" <ke**********@hotmail.com> wrote in message
news:D6**********************************@microsof t.com...
Can anybody let me know the difference between public and private class
access modifiers? Thanks in advance


Do you mean class modifiers(ie public class?) If so there is only public and
internal.
Public means that the class is available to anyone who has referenced the
assembly, while internal means the class is only accessible to the current
assembly.

private on a member means that the member is restricted to the class and its
nested classes.
Jul 21 '05 #2
Daniel O'Connell [C# MVP] <onyxkirx@--NOSPAM--comcast.net> wrote:
"kchalla" <ke**********@hotmail.com> wrote in message
news:D6**********************************@microsof t.com...
Can anybody let me know the difference between public and private class
access modifiers? Thanks in advance


Do you mean class modifiers(ie public class?) If so there is only public and
internal.


Not quite - a nested class can be private, in which case it's only
visible to the enclosing class, or protected in which case it's only
visible to classes derived from the enclosing class.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #3

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Daniel O'Connell [C# MVP] <onyxkirx@--NOSPAM--comcast.net> wrote:
"kchalla" <ke**********@hotmail.com> wrote in message
news:D6**********************************@microsof t.com...
> Can anybody let me know the difference between public and private class
> access modifiers? Thanks in advance


Do you mean class modifiers(ie public class?) If so there is only public
and
internal.


Not quite - a nested class can be private, in which case it's only
visible to the enclosing class, or protected in which case it's only
visible to classes derived from the enclosing class.


Ahh nested classes, my great nemisis. I constantly forget they exist(One of
my prototype compilers didn't even support them...who knows how I managed to
implement by the spec and still forget nested types). You are quite correct.
Jul 21 '05 #4

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

Similar topics

18
by: Jason Heyes | last post by:
Is this class evidence of poor design? class Rectangle { double width, height; public: double get_width() const { return width; } double get_height() const { return height; } void...
4
by: Dennis C. Drumm | last post by:
Is there a way with C# to allow one class access to a method or field of another class, without making that method or field visible to all other classes, as would be the case when making the method...
4
by: Picho | last post by:
Hi all, Using reflection, I can invoke/call private methods of an object. is this intended? if yes, why? in what scenario (example would be good) should I be givven the option to use...
2
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
19
by: hamil | last post by:
I have a form with one button, Button1, and a Textbox, Textbox1 I have a class, class1 as follows. Public Class Class1 Public DeForm As Object Sub doit() DeForm.Textbox1.text = "It works"...
3
by: kchalla | last post by:
Can anybody let me know the difference between public and private class access modifiers? Thanks in advance
3
by: RitualDave | last post by:
This compiles and runs successfully in VS2005: ref class A { private: ~A() { this->!A(); } // private! !A() { } // private! }; ....
4
by: tony | last post by:
Hello! The general form of a class definition is the following. class ClassName : ] The modifiers is optional. If modifiers is blank what exactly does that mean? What availability do I have...
2
by: devgupta01 | last post by:
I have seen the class with public and without modifiers and method with public, protected or private modifiers. I am confused how to decide modifiers for a class?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
marktang
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,...
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 projectplanning, 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.