answersLogoWhite

0

Yes. Static members can be private or public. (Or protected.)

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

Where is the global declaration section of a c plus plus program?

Anything declared outside of a function is global.


Which one is the compulsory section in a java program?

Class declaration


What is a C plus plus program to demonstrate the use of access specifiers?

Access specifiers apply to class and struct data types only. If a member is declared before an access specifier is declared, the default access is implied. Once an access specifier is declared, that specifier remains in force until another specifier is declared. Specifiers can be declared in any order and may be repeated as often as required. The following demonstrates usage and purpose of each specifier. class X { friend void f(); // Friends can be declared anywhere. private: // The default access specifier for class types (implied if omitted). int a; // Only accessible to members of X and to friends of X. protected: int b; // Same as private, also accessible to derivatives of X. public: int c; // Accessible to any code where X is visible. }; struct Y { friend void f(); // Friends can be declared anywhere. public: // The default access specifier for struct types (implied if omitted). int a; // Accessible to any code where Y is visible. protected: int b; // Same as private, also accessible to derivatives of Y. private: int c; // Only accessible to members of Y and friends of Y. }; struct Z : X {}; void f() { X x; x.a = 42; // OK! X::a is private and f is a friend of X. x.b = 42; // OK! X::b is protected and f is a friend of X. x.c = 42; // OK! X::c is public and X is visible to f. Y y; y.a = 42; // OK! Y::a is public and Y is visible to f. y.b = 42; // OK! Y::b is protected and f is a friend of Y. y.c = 42; // OK! Y::c is private and f is a friend of Y. Z z; z.a = 42; // OK! Z::Y::a is public and Z is visible to f. z.b = 42; // OK! Z::Y::b is protected and f is a friend of Y. z.c = 42; // OK! Z::Y::c is private and f is a friend of Y. } int main() { X x; x.a = 42; // error! X::a is private and main is not a friend of X. x.b = 42; // error! X::b is protected and main does not derive from X. x.c = 42; // OK! X::c is public and is X is visible to main. Y y; y.a = 42; // OK! Y::a is public and is Y is visible to main. y.b = 42; // error! Y::b is protected and main does not derive from Y. y.c = 42; // error! Y::c is private and main is not a friend of Y. Z z; z.a = 42; // OK! Z::Y::a is public and Z is visible to main. z.b = 42; // error! Z::Y::b is protected and main is not derived from Y. z.c = 42; // error! Z::Y::c is private and main is not a friend of Y. }


Why static variables are initialized to zero?

When a variable is declared, your computer assigns a section of memory to that variable. If the variable isn't initialized, there's no way of knowing what data is already stored in that section of memory, which can cause errors in your programs. In managed languages, such as C#, this is done automatically at declaration. Although it's still good practice to initialize variables yourself.


Parts of the program C plus plus?

parts of a programStructure of C++ programDocumentation SectionPreprocessor SectionDefinition SectionGlobal Declaration Sectionmain(){Declaration part;Executable part;}sub program section{Sub program execution part}

Related Questions

Where is the global declaration section of a c plus plus program?

Anything declared outside of a function is global.


What section of the declaration of independence is considered a declaration of war?

Last Section


Which section of the Declaration of Independence defines democracy.?

The first section of the Declaration of Independence defines democracy.


What is section of the Declaration of independence is considered declaration of war?

Last.


What section of the Declaration of Independence defines democracy.?

the last section


How many major section does the declaration?

the declaration has four major sections.


When summer 2009 result of AMIE section B will be declared?

summer 2009 result of AMIE section B will be declared on 15th Sep-09


What does not appear in the Declaration of Rights section of the Declaration of Independence?

Women should have a voice in Government


What the define of the declaration of independence?

the last section


Why the colonists declared independence from great Britain?

The Declaration of Indepence stated reasons why the colonists wanted their freedom from England, as there was a whole section called The List of Grieveances dedicated to list reasons why they were to break apart. There are 27 reasons.


The Signing of the Declaration of Independence is a question that could be made from the section heading above A. Who signed the Declaration of Independence B. Why was the Declaration of Independe?

Who signed the Declaration of Independenc?


On stardoll in clubs when you make your club private and a person joins how do you let them join?

you go to your club then go to the members section and then it will say unanswered requests them you can accept or decline