Академический Документы
Профессиональный Документы
Культура Документы
Answer
Various data types in C++:
Numeric: This is a fundamental type provided by C++ language. Integers, Floating point
types come under this.
Boolean: Can have one of the two values, true or false. It is used to express the results of
a logical operations. They are internally stored as number. A non-zero value is considered
true whereas zero is false.
Eg:
Void f(int x, int y)
{
Bool b;
If (x == y)
b = true;
}
The declaration of the inner block hides the declaration of same variable in outer block.
This means, within the inner block, the variable x will refer to the data object declared
therein. To access the global version of the variable, C++ provides scope resolution
operator.
In the above example, x has a value of 20 but ::x has value 10.
Similarly, this operator is used when a member function is defined outside the class
e.g.
Class MyClass
{
int n1, n2;
public:
{
void func1(); ---------Function Declaration
}
};
Note that once const is defined, its value can not be changed by arithmetic operations or
assignment.