Keywords which are commonly used in C++ programming:
Below are some keywords listed:
1. class – It is used for declaring/defining a class.
2. new – It is used to allocate storage on the free store space in computer system(heap).
3. delete – It is used to de-allocate the storage on the free store space in computer system.
// new and delete are more robust than the C library functions malloc and free.
4. inline – It is used for inline member functions.
5. private/protected/public – These are the access specifiers used for data hiding which is a means of protecting data of a class.
private – These types of data are not visible outside of the class.
protected – These types of data like private except visible only to derived classes through inheritance.
public – These types of data are visible to all applications.
try/throw/catch – It is used in exception handling.
6. friend – It is declares a class will full access rights to private and protected members of an outside class without being a member of that class.
7. explicit – It prevents implicit conversion of a data type to a particular class that may lead to unexpected surprises:
8. array::array(size_t n); creates an array with n elements.
9. float max(array const &a); a function that uses the array data type.
10. max(m); where m is an integer inadvertently passed to the function.
// A new array of m elements will be implicitly created automatically, which is not what was intended.
virtual – a declaration specifier that invokes polymorphism on a function.
11. bool/false/true – used for Boolean logic.
bool – new data type that can only accept the values true and false.
false – numerically zero.
true – numerically one.
Thanks
Mukesh Rajput
Post A Comment:
0 comments: