Q3. What is difference between dynamic and reference declaration of variable? Answer: Dynamic initialization is extensively used in object-oriented programming. We can create exactly the type of object needed using information that is known only at the run time. C++ introduces a new kind of variable known as the reference variable. A reference variable provides an alias (alternative name) for a previously defined variable. For example, if we make the variable sum a reference to the variable total, then sum and total can be used interchangeably to represent the variable. Q4.What is type casting? explain the use of type casting with suitable example. When there are two operands of different types in an expression, the lower-type variable is converted to the type of the higher-type variable. For example, if one operand is of type int and other is of float , both are converted into float type. Thus, if data type...
Learn something about IT