Variables in C++

Scope refers to region of the program. There are three ways in which variables in c++ can be decleared namely within the function or block (local variables), definition of function parameters (formal parameters) and outside of functions (called global variables).

Constants/Literals in C++

These are fixed values that cannot be altered in the program. They are also called literals. Their values cannot be modified following definition.

Modifier Types in C++

Char, int and double data types in C++ have modifiers preceding them. Modifiers alter the precise meaning of the base type to fit situations.

Data type modifiers include:

  • Signed
  • Unsigned
  • Long
  • Short

C++ Storage Classes

A storage class defines the lifetime and scope of variables and/or functions within C++. Specifiers precede types being modified. Storage classes in C++ programs include the following:

  • Auto
  • Static
  • Register
  • Extern
  • Mutable

Operators in C++

A operator is a symbol which enables the compiler to perform mathematical or logical functions. C++ has the following types of operators:

  • Relational operators
  • Arithmetic operators
  • Logical operators
  • Assignment operators
  • Bitwise operators
  • Miscellaneous operators

Loop Types in C++

For handling looping requirements, the following options are available in C++:

  • While
  • For
  • Do….While
  • Nested

Decision Making in C++

This is based on any one of the following types of statements:

  • If statement
  • If….else statement
  • Switch Statements
  • Nested if statements
  • Nested switch statements

C++ Functions

This comprises a function header and body. Functions contain the following parts:

  • Return type
  • Function name
  • Parameters
  • Function body

C++ Classes and Objects: Class definition commences with keyword class and class name as well as class body. Class definition should be followed by semicolon or list of declarations. Class provides the blueprint for objects. Object is born from class. Public data members of objects of class can be accessed through direct member access operators.

Inheritance and Overloading: How C++ Adds On

A most important concept in object oriented programming is inheritance which lets a derived or new class inherit the members of the existing or base class. Class can be derived from more than one classes and can inherit data and functions from numerous base classes. Overloading allows users to specify more than one definition for function name or operator known as function and operator overloading respectively.

Comments

Popular posts from this blog