text: Computer Programming
  Java Programming
  C++ Programming
  How can a value from the derived class be assigned to a variable in base class?
  Remember that derived classes can access the public and protected members of their base class, but none of the private members. If the member variable in the base class is protected (rather than private), then the derived class can assign it directly. However, this is bad style in OOP as it undermines data-hiding. A protected mutator (set accessor) would be a better option.
  Related Questions
  Asked in Java Programming, C Programming
  Can a double value be assigned to a float value?
  Asked in Statistics, Java Programming
  What are the difference between private variable and final variable?
  Asked in Computer Programming, Java Programming, C Programming
  What value is assigned to extern variable?
  Asked in Science, Definitions, C Programming
  How do you use define in C?
  Asked in Math and Arithmetic, Algebra, Trigonometry
  What is an expression with one variable?
  Asked in Chemistry, Science Experiments, Biochemistry
  What is the definition of constant variable?
  Asked in Math and Arithmetic, Percentages, Fractions, and Decimal Values
  What is the decimal value of the letter u?
  Asked in Java Programming
  Can an int value be assigned to String variable?
  Asked in Science, Computer Programming, Units of Measure
  Difference between preincrementing a variable and postincrementing a variable?
  Both increment the value of the variable by one. The difference is the value of the increments expression itself. With preincrement value is taken after incrementing, and with postincrement value is taken before incrementing. Example: Let x have value 5. y = ++x; Both y and x are assigned value 6. Again let x have value 5. y = x++; y is assigned value 5. x is assigned value 6.
  Asked in Statistics, Java Programming, C Programming
  How do you assign values to variables?
  it depend on the programming language u use. for instance in c, just decalre the variable and equal it to the value it is to take. eg. my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ //for php $my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ for strings (in php) eg. $my_age="none of ur business" /*$my_age is the variable and the string "none of ur business" is the assigned value*/
  Asked in Ruby Programming
  Which is the default variable storage class type in a function?
  Asked in Java Programming, C Programming
  Can an float value be assigned to int variable?
  In C a float value can be assigned to an integer variable but an implicit casting occurs when compiler forces a float value to be assigned as an integer. So that the digits after the decimal notation in the float value get loss after assigning a float to an integer. eg: int a=12.356;// Implicit casting occurs printf("%d",a);// when printing a it shows as 12 as an integer
  Asked in Java Programming
  What is a transient variable?
  Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the val ue of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null
  Asked in Math and Arithmetic, Algebra
  2 plus t7 -1?
  Asked in Java Programming
  What is the function of default values in java?
  Default values are available for any class or instance variable. If you do not specify a value for a class or instance variable the JVM will provide a default value that will ensure that the system does not end up with any unexpected errors because you used a variable that was not initialized. Ex: Public class Test { int I; } In the above class we have just declared an instance variable called 'I' but we haven't associated any value to it. The JVM automatically assigns 0 as the default value to this variable.
  Asked in Java Programming
  Which qualifier is used to declare read-only variable in java?
  Asked in Sentence and Word Structure
  What does open sentence mean?
  Asked in Java Programming, C Programming
  Can an int value be assigned to float variable?
  Yes, an integer can be assigned as a float value. But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types. eg: float b=12;// an integer constant is assigned to a float variable printf("%f",b);// when printing b it will print as 12.000000
  Asked in Computer Programming, Java Programming
  What does a Java Boolean type variable declared but not yet initialized contain when its class is instanciated?
  Asked in Java Programming, .NET Programming, Visual Basic Programming
  What does instance field mean in Java?
  Asked in Java Programming, Statistics
  What is Difference between class variable and instance variable with example?
  Well, at the basic level, class fields, or static fields, as they are called sometimes, belong to the class and not to any particular instance of the class. Class fields can be assigned without instantiation of instance objects of a class. For example: public class ExampleClass { public static String classField = ""; public String instanceField = ""; } I can assign a value to classField just like that: ExampleClass.classField = "new value"; Instance fields, on the other hand, belong to a particular instance of the class. Thus, to assign an instance field a value, you have to first instantiate an object of the class just like that: ExampleClass obj1 = new ExampleClass(); obj1.instanceField = "new value";
  Asked in Computer Programming
  How Can a derived class access an integer variable of base class in qt?
  The best design strategy would be to provide a protected accessor (getter) that returns the variable either by value or by constant reference. If the derived class needs to mutate the variable, then provide a protected mutator (setter). Only derived classes have protected access to their base classes. However, derivatives can also lower that access to private with respect to their own derivatives, if desired. Even if the variable does not represent a class invariant, it's still best to provide an interface rather than expose an implementation detail outside of the class, whether that exposure is public or protected. In this way the implementation detail may be changed at a future time without affecting any of the consumers of your class (including derivatives), since they will all be using the public or protected interface. So long as that interface remains unchanged, the scope of your internal changes is limited to the class itself, thus you won't break any code that uses your class. If your class already provides a public interface to the variable, then your derived class can obviously make use of that as well. You only need a protected interface when no public interface is provided.
  Asked in Computer Programming
  What is the advantage of static character variable?
  Static variables exist for the entire duration of the program. Therefore a static character variable is a character that exists for the entire duration the program is running. Regardless of where a static variable is declared and initialised, it is physically instantiated and initialised when the program loads. If the variable has function scope, whatever value is currently assigned to the variable will remain in effect the next time that function is called, but only the function can modify the variable. If the variable has class scope, then the variable exists even if no instances of the class have yet been instantiated, but any and all instances share the variable (it is common to the class, not to any one instance of the class). Static class variables must be initialised outwith the class body and outwith any other function body, but can only be modified by the class members (both static and non-static) and by friends of the class. If the variable has file scope, then the variable is a global variable. Global variables are largely frowned upon as there's no way to control what code can modify the value. Passing local function variables to other functions is the preferred method as this gives much greater control over which code can access and/or modify the value, as well as limiting the lifetime of the variable. To ensure the variable exists throughout a program's lifetime (as per a static variable), instantiate the variable from within the program's entry point.
  Asked in Science, C Programming, Algebra
  To evaluate a variable you must values for the variable and then calculate the result?
  No. To evaluate a variable, you simply take its value. When you assign a value to a variable, the evaluation of that operation is the value of the variable after assignment. There is no calculation required to evaluate a variable, unless that calculation is part of the right-hand operand of an assignment operation, in which case the calculation is evaluated first and the result of that evaluation (the value) is then assigned to the variable which is then evaluated.
  Asked in Computers, JavaScript, The Difference Between
  What are the difference between null and undefined in Javascript?
  