Corrected capitalization, corrected to American spellings and typos (#30685)
* Translate challenge subtitles and example challenge text to Spanish * Corrected errors in syntax and punctuation * Multiple corrections of it/s to its plus other grammar corrections * Correction and added paragraph to CSS Flex article * Corrected my own typo * Corrected capitalization, American spellings and typos
This commit is contained in:
@ -21,7 +21,7 @@ const int y = 10; // y is set to 10.
|
||||
const_cast<int &>(y) = 20; // undefined behaviour.
|
||||
```
|
||||
### dynamic_cast
|
||||
Dynamic cast is used to cast an object within it's class hierarchy (to parent, from parent and to siblings). Dynamic cast can only be called on polymorphic classes. Thus, the original class in this case `MyClass` must have a virtual member, which is present in the form of the virtual destructor.
|
||||
Dynamic cast is used to cast an object within its class hierarchy (to parent, from parent and to siblings). Dynamic cast can only be called on polymorphic classes. Thus, the original class in this case `MyClass` must have a virtual member, which is present in the form of the virtual destructor.
|
||||
|
||||
If dynamic cast fails, it will return a `nullptr`. Dynamic cast may be useful in determination of object types at runtime. However, it should be noted that dynamic cast is not free and in some cases other techniques may prove to be more efficient at determination of class type at runtime.
|
||||
|
||||
|
@ -78,7 +78,7 @@ Now let's read about a new type of variable-
|
||||
#### Static variable
|
||||
|
||||
Static variables : When a variable is declared as static, space for it gets allocated for the lifetime of the program. Even if the function is called multiple times, space for the static variable is allocated only once and the value of variable in the previous call gets carried through the next function call. This is useful for implementing coroutines in C/C++ or any other application where previous state of function needs to be stored.
|
||||
In layman terms , it means that a normal variable when goes out of scope looses it's identity (value) , but a static variable has a global scope and retain it's value till end of program , but unlike global variable it is not necessary to declare it at start of program.
|
||||
In layman's terms , it means that when a normal variable goes out of scope it loses its identity (value), but a static variable has a global scope and retains its value until the end of the program, but unlike a global variable it is not necessary to declare it at the start of the program.
|
||||
|
||||
#### EXTRA-
|
||||
Static is a keyword in C++ used to give special characteristics to an element. Static elements are allocated storage only once in a program lifetime in static storage area. And they have a scope till the program lifetime.
|
||||
|
@ -113,7 +113,7 @@ for(auto it = v.begin(); it != v.end(); it++) { //notice use of auto keyword
|
||||
cout<<*it<<endl; //Will print out string that the iterator is currently ppointing to
|
||||
}
|
||||
```
|
||||
From here, you can do all sorts of cool stuff, like manipulating the vector or mess around with it's order as you please!
|
||||
From here, you can do all sorts of cool stuff, like manipulating the vector or mess around with its order as you please!
|
||||
|
||||
### Some useful member functions
|
||||
The standard template library (STL) also provide different *methods* for you:
|
||||
|
Reference in New Issue
Block a user