473,405 Members | 2,344 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.

omit the pirvate/public etc

Hi,

If you omit private / public / protected etc in a declaration then What is
it ? pirvate, protected ?

eg:
bool test;
bool check
{
return (something == false);
}

--
rgds, Wilfried
http://www.mestdagh.biz
Nov 16 '05 #1
5 1853
Jay
Default is always private.

- Jay

"Wilfried Mestdagh" <Wi**************@discussions.microsoft.com> escreveu na
mensagem news:B4**********************************@microsof t.com...
Hi,

If you omit private / public / protected etc in a declaration then What
is
it ? pirvate, protected ?

eg:
bool test;
bool check
{
return (something == false);
}

--
rgds, Wilfried
http://www.mestdagh.biz

Nov 16 '05 #2
private
"Wilfried Mestdagh" <Wi**************@discussions.microsoft.com> wrote in
message news:B4**********************************@microsof t.com...
Hi,

If you omit private / public / protected etc in a declaration then What is it ? pirvate, protected ?

eg:
bool test;
bool check
{
return (something == false);
}

--
rgds, Wilfried
http://www.mestdagh.biz

Nov 16 '05 #3
The default depends upon what you are declaring:

http://msdn.microsoft.com/library/de...spec_3_5_1.asp

"...when a member declaration does not include any access modifiers,
the context in which the declaration takes place determines the default
declared accessibility.

"Namespaces implicitly have public declared accessibility. No access
modifiers are allowed on namespace declarations.
"Types declared in compilation units or namespaces... default to
internal declared accessibility.
"Class members... default to private declared accessibility.
"Struct members... default to private declared accessibility because
structs are implicitly sealed.
"Interface members implicitly have public declared accessibility. No
access modifiers are allowed on interface member declarations.
"Enumeration members implicitly have public declared accessibility. No
access modifiers are allowed on enumeration member declarations.

Nov 16 '05 #4
Jay
You're right. I just considered the defaults for variables.

-Jay

"Bruce Wood" <br*******@canada.com> escreveu na mensagem
news:11********************@o13g2000cwo.googlegrou ps.com...
The default depends upon what you are declaring:

http://msdn.microsoft.com/library/de...spec_3_5_1.asp

"...when a member declaration does not include any access modifiers,
the context in which the declaration takes place determines the default
declared accessibility.

"Namespaces implicitly have public declared accessibility. No access
modifiers are allowed on namespace declarations.
"Types declared in compilation units or namespaces... default to
internal declared accessibility.
"Class members... default to private declared accessibility.
"Struct members... default to private declared accessibility because
structs are implicitly sealed.
"Interface members implicitly have public declared accessibility. No
access modifiers are allowed on interface member declarations.
"Enumeration members implicitly have public declared accessibility. No
access modifiers are allowed on enumeration member declarations.

Nov 16 '05 #5
Wilfried Mestdagh <Wi**************@discussions.microsoft.com> wrote:
If you omit private / public / protected etc in a declaration then What is
it ? pirvate, protected ?


It's always the most private it can be - so for top-level types it's
internal, for member variables it's private, etc.

This is a really good default setting, as it means you can omit the
access modifier and be on the safe side - any access modifier means
that you're deliberately making it more public.

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

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

Similar topics

24
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html...
6
by: STF | last post by:
While reading the C++ tutorial in this page: http://www.cplusplus.com/doc/tutorial/tut2-2.html I'm astonished to learn that we could omit curly brackets in function declaration for single...
1
by: RB | last post by:
What is the best way to omit a header (44 bytes length) from a binary file? Thanks in advance, Rita
2
by: hellrazor | last post by:
Hi there, I'm successfully streaming a list of items into a radiobuttonlist. I am using an ArrayList as a data source, which I have built from a table of values in a MySQL table. It's working...
2
by: Charles Law | last post by:
I have a complex object that I am serializing, and I would like to omit elements that have a default value. For example, if I have a class as follows Public Class Test Private m_Name As...
0
by: Samuel | last post by:
All, I am at wits end with this one. Spent hours going through MSDN and online articles to try to resolve this. XmlSerializer is including the “xsi:type” attribute when I serialize a...
2
by: tony | last post by:
Hello! I have this template class with a default type (please do not give too much importance to the actual code, it's just an example, it's not a useful implementation of anything nor a good...
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: 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
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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.