1/09/2015

C++ _ Scope of any Identifier : Talks to you



# Scope ?
    # In C++ before using any variables, functions, classes and types or compound types needs to be declare first somewhere in your C++ program.
    # Where you declare or define them, decides their visibility.
    # Visibility means whether you can use that everywhere or somewhere in your program.

# GLOBAL variables ?
    # A list of variables that can be used anywhere in your program without even declaring and defining them are GLOBAL variables.

# LOCAL variables ?
    # Those who exists in some defined code blocks.
    # outside that code block they does not exists.
    # sometimes local variables are used to protect GLOBAL variables.

 # In C++ you can declare a identifier once within a single scope.
 # In C++ visibility of Identifiers is influenced by curly brackets that is used to group more than one C++ statements together.
# This means you can create a new scope/world for your new/old variables.

 # Namespace ?
    # Namespace is a C++ Identifier that used to group some code functionality within a single name of identifier.
    # You must be familiar with  std  that is a namespace in C++ that holds all
standard C++ functions/routines, Global variables, Classes.

    # while printing something to Console/Terminal you use :-
        std::cout << "Hello world!" << endl;

    # This is how you can access any function or routine from std namespace even without importing anything from there.


# If you know Java/C#, than you may be familiar with this concept.


# Importing selected Identifiers from any Namespace ?


# Importing everything from selected Namespace into current scope ?

# scope matters while importing anything from any Namespace.



# Static , Global, and Local variables ?

  
# References :-
    http://www.cplusplus.com/doc/tutorial/namespaces/

No comments :