what is a protected class?
26943
It appears that the question period has expired.  If you have received an answer that meets your needs, please choose one of those as a 'best answer.'  If you haven't received a good answer for your question, you may want to consider the following,\n\n1) Re-post your question.  Newer questions get more activity on Yahoo! Answers than old ones.\n2) If you do re-post your question, consider why it wasn't answered the first time.  Could it be more specific?  Could it be worded better? Were there grammatical or spelling errors? Was it in the best category?\n\nIf it doesn't seem likely that re-posting your question will help you, then here's a listing of my favorite 'answer sites'.  Maybe one of them will help you.\n\nAnswers.com http://www.answers.com/\nBartleby http://www.bartleby.com/\nYahoo Reference http://education.yahoo.com/reference/\nHowStuffWorks http://www.howstuffworks.com/\nWikipedia http://en.wikipedia.org/wiki/Main_Page\n\nSince I really haven't answered your question, it is not necessary to give me any points.  Regards.
78985
No it does not.\n\nSometimes it's appropriate to have exactly one instance of a class: window managers, print spoolers, and filesystems are prototypical examples. Typically, those types of objects—known as singletons—are accessed by disparate objects throughout a software system, and therefore require a global point of access. Of course, just when you're certain you will never need more than one instance, it's a good bet you'll change your mind.\n\nThe Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:\n\n    * Ensure that only one instance of a class is created\n    * Provide a global point of access to the object\n    * Allow multiple instances in the future without affecting a singleton class's clients\n\nAlthough the Singleton design pattern—as evidenced below by the figure below—is one of the simplest design patterns, it presents a number of pitfalls for the unwary Java developer. This article discusses the Singleton design pattern and addresses those pitfalls. \n\n Example 1. The classic singleton\n\npublic class ClassicSingleton {\n   private static ClassicSingleton instance = null;\n\n   protected ClassicSingleton() {\n      // Exists only to defeat instantiation.\n   }\n   public static ClassicSingleton getInstance() {\n      if(instance == null) {\n         instance = new ClassicSingleton();\n      }\n      return instance;\n   }\n}\n\nThe singleton implemented in Example 1 is easy to understand. The ClassicSingleton class maintains a static reference to the lone singleton instance and returns that reference from the static getInstance() method.\n\nThere are several interesting points concerning the ClassicSingleton class. First, ClassicSingleton employs a technique known as lazy instantiation to create the singleton; as a result, the singleton instance is not created until the getInstance() method is called for the first time. This technique ensures that singleton instances are created only when needed.\n\nSecond, notice that ClassicSingleton implements a protected constructor so clients cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:\n\npublic class SingletonInstantiator {\n  public SingletonInstantiator() {\n   ClassicSingleton instance = ClassicSingleton.getInstance();\nClassicSingleton anotherInstance =\nnew ClassicSingleton();\n       ...\n  }\n}\n\nHow can the class in the preceding code fragment—which does not extend ClassicSingleton—create a ClassicSingleton instance if the ClassicSingleton constructor is protected? The answer is that protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.\n\nA third interesting point about ClassicSingleton: it's possible to have multiple singleton instances if classes loaded by different classloaders access a singleton. That scenario is not so far-fetched; for example, some servlet containers use distinct classloaders for each servlet, so if two servlets access a singleton, they will each have their own instance.\n\nFourth, if ClassicSingleton implements the java.io.Serializable interface, the class's instances can
640622
Scope is the visibility of a variable, a method, or a property or other member of a class.  \n\nGood programming style will limit scope of variables as much as possible.  For example, a complex algorigthm might have hundreds of lines of code, dozens of variables, complex calculations etc.  But from the outside, calling the method should be as simple as possible.  \n\nResticting scope makes the use of the object or function easier to use, and also protects the variables use internally from misuse, whether unitentional or otherwise.  \n\nIn most languages, varibles can be:\n public (visible and usable by everyone)\n internal (not visible or usable by anyone outside the method or class)\n protected (only visible or usable by derived classes)\n shared (also called static, shared by all instances of a class or method)
595133
A class is a data type that encapsulates data and operations on data in a single unit. Before object-oriented programming, data and operations (functions) were treated as separate elements. An object is an instance of a class. That is, it is a value whose type is a class. The term object is often used more loosely in this documentation and where the distinction between a class and an instance of the class is not important, the term "object" may also refer to a class.\n\nYou can begin to understand objects if you understand Pascal records or structures in C. Records are made of up fields that contain data, where each field has its own type. Records make it easy to refer to a collection of varied data elements.\n\nObjects are also collections of data elements. But objects--unlike records--contain procedures and functions that operate on their data. These procedures and functions are called methods.\n\nAn object's data elements are accessed through properties. The properties of many Delphi objects have values that you can change at design time without writing code. If you want a property value to change at runtime, you need to write only a small amount of code. \n\nThe combination of data and functionality in a single unit is called encapsulation. In addition to encapsulation, object-oriented programming is characterized by inheritance and polymorphism. Inheritance means that objects derive functionality from other objects (called ancestors); objects can modify their inherited behavior. Polymorphism means that different objects derived from the same ancestor support the same method and property interfaces, which often can be called interchangeably.
249182
Final just means that the method (or variable) it refers to cannot be modified on s subclass. It is actually redundant on a static anyway because statics are never part of an oject instance.
184566
An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.
23050
Generally if you have a static variable as part of a class declaration, it means that the variable is shared across all instances of the class.\n\nclass A\n{\n  static int i = 1;\n}\n\nA a;\nASSERT( a.i == 1 )\na.i = 5;\nA aa;\nASSERT( aa.i == 5 )\n\nIn C and C++, if you declare a static variable that is not part of a class, it means that it can only be referenced in that specific source file and no others.
35090
Elflemming is correct.\nWhen you run the class state it is loaded in JVM. Then when you use Example class it is then loaded on JVM. Keep in mind, no instance is created, only class is loaded.\nWhenever you use a class for first time JVM loads it . When loading class it initializes all static variable and executes static initializer.( If exists.)\nSo no instance of exaple class will be created.
390812
OOP: OBJECT ORIENTED PROGRAMMING.\n\nThe whole idea of OOP is to be able to encapsulate data and methods (or member functions as they are called) to protect them.\n\nThis is done by creating a class and letting your class hold information. Then you can just reference the class in any program and use its functionality. This makes for a powerful programming capability and also promotes code reuse. often times you can just reuse an entire class or even use a class after you have modified it a bit. The .NET framework is based on this idea of using various classes to build applications rapidly.\n\nI'd suggest you pick a book up on C++ the one i've used for many years is C++ how to program by Deitel and Deitel. They should have an elaborate section on Classes and Inheritance and the whole OOP&D subject in general.
520482
protecting from what?
224979
Mainly VB.NET makes use of the .NET framework which makes it more powerful since it allows it to access so many different classes.
998302
An adapter class is a class that provides a dummy (empty) implementation for an interface. That way someone who wants to implement the interface but does not want or does not know how to implement all methods, can use the adapter class instead, and only override the methods he is interested in.\n\nThe most common use of adapters is in event listeners, classes that define callback for various events. For example java.awt.event.MouseAdapter (http://java.sun.com/j2se/1.5.0/docs/api/java/awt/event/MouseAdapter.html) is an adapter for the java.awt.event.MouseListener event listener interface (http://java.sun.com/j2se/1.5.0/docs/api/java/awt/event/MouseListener.html)
29500
I think c is true becuse a varible name can not contain any thing other than lettera and digit if you add _ in letters.\nBut a class may not have constructor when default constructor will be used.
210645
Least restricted is often misinterpreted.  For example, an agoraphobic would be very restricted if he had to go to a classroom for his education.  It depends upon the individual.
893508
here:\nclass time\n{\n   int t;\n   public:\n   time() : t(0) {} \n   time(int x) : t(x) {}\n   time(int m, int s) : t(m*60+s) {}\n   int m() {return t/60;}\n   int s()  {return t%60;}\n   operator int () {return t;}\n};
805218
private means the variable can be accessed only from within the same class as the variable.\nfriend means the variable can be accessed by code within the same project or component
1075666
"this" is a reference to the current class or object. It's frequently used in that way:\n\nclass Foo {\n    int x;\n\n    void setX(int x) {\n          this.x = x;\n    }\n}\n\nThis way you can access the field x though it's overridden by the use of the identifier x as a function parameter.