ask mrs. jain
Yes. Static members can be private or public. (Or protected.)
An accessor is a method in a Java Bean that is used to access the private variables of the class. Usually instance variables in a bean are declared as private and they can be accessed only via these accessor methods. Ex: public class Employee { private String name = ""; private int age = 0; public String getName(){ return this.name; } public void setName(String nm){ this.name = nm; } public int getAge(){ return this.age; } public void setAge(int ag){ this.age = ag; } } In the above example name and age are instance variables and the methods beginning with get and set are the accessor methods.
A class can either be default or public it can never be declared as private, so the question of abstract class at the file level does not arise. But an inner class can be declared private and abstract as well.
This is not necessarily true. The only rules for this are that interface methods may not be private. They may be public, protected, or have the default (blank) access modifier.
Yes, but since it is public there is no need to; any code outwith the class can access a public data member directly. If it were a private data member, then returning by reference would defeat the point of making it a private data member in the first place; you might as well make it public. Private data members should always be returned by value, never by reference and never by pointer, and data members should only be declared public if they are not critical to the internal operation of the class.
The public sector is a government (city, state, national); the private sector is a business. Public sector jobs are publicly-funded (by taxes, for instance) whereas private sector jobs depend on the revenue of the business
The same economic principles should apply in both private and public. The same standards should apply to all dealings both private and public.
The public, protected and private keywords only apply to object oriented programming languages. They are used to determine the accessibility of specific class members and their bases. Private members are only accessible to the class and to friends of the class. Protected members are the same as private but are also accessible to derivatives of the class. Public members are accessible to all code. When applied to base classes, the public, protected and private keywords can be used to either maintain or reduce the accessibility of the base class members (but never to increase their accessibility). When declared public, the accessibility of the base class members remains as defined by the base class. When declared protected, the public members become protected members. And when declared private, all members of the base class become private members. As well as defining the overall accessibility of the base class members, the accessibility of individual base class members can also be specified.
Constructors are not declared public only. They can be declared protected and private, as required by the class. Protected constructors are only accessible to the class members and to derived classes. Private constructors are only accessible to the class members. Although a default public constructor is required by the majority of classes, it is not true of all classes. Derived classes can call any public or protected base class constructor explicitly via their own construction initialisation sections. Private construction is typically used in the singleton model to instantiate a private static instance of the class as and when it is required, whilst preventing multiple instances of the class from being created. However, class members also include friends of the class, thus external friend classes and friend functions can also instantiate objects via their private constructors. Note that the whole point of public, protected and private access is not to hide information (as is often wrongly said) but in order to limit access to that information. The same applies to a class' constructors as it does to its member methods and member variables.
Public members in C++ have accessibility to any function that has scope to the instance of the class, whereas private members have accessibility only to functions of that class.
Public derivation or public inheritance means that all the public members of the base calls are declared public in the derived class while the protected members remain protected. Protected inheritance means all the public members of the base class are declared protected in the derived class, as are the protected members. Private inheritance means all the public and protected members of the base class are declared private in the derived class. Private members of the base class are never inherited and are therefore unaffected by inheritance. Note that regardless of the type of inheritance specified, individual non-private members of the base class can be inherited with public or protected access as required of the derived class. The type of inheritance can be therefore be thought of as being the default inheritance for all base class members which can (optionally) be overridden for specific members where required.
privet