473,372 Members | 950 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,372 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 1720

"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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
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
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...

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.