Problem Solving with C++ Plus MyLab Programming with Pearson eText -- Access Card Package (10th Edition)
Problem Solving with C++ Plus MyLab Programming with Pearson eText -- Access Card Package (10th Edition)
10th Edition
ISBN: 9780134710747
Author: Walter Savitch
Publisher: PEARSON
Question
Book Icon
Chapter 12.2, Problem 10STE
Program Plan Intro

Namespace:

  • Namespace is a group of name definitions such as definition of class and declaration of variable.
  • Generally, the namespace in C++ is used in the ways of “std” namespace. The “std” namespace contains each and every name defined in the standard library files that user use such as “iostream” and “sdtdlib”.
  • If the user do not place the code in some exact namespace, then the code in a namespace known as the global namespace.
    • The global namespace does not contain a “using” directive because users are continuously using the global namespace.
  • Consider a name that is defined in two namespaces. When the user tends to use the namespaces that are defined that is if the user uses both namespace, then the resultant that is obtained will contain error in it.

Blurred answer
Students have asked these similar questions
6. Write a function called tallEnough() that takes a single parameter, the user’sheight in inches. If the height is 48 or more, the function should return “You can go onthis ride.” Otherwise it should return the string “Sorry, you’re not tall enough.”>>> tallEnough(46)"Sorry, you're not tall enough.">>> tallEnough(48)'You can go on this ride.'
Write the definition of a void function with three reference parameters of type int, double, and string. The function sets the values of the int and double variables to 0 and the value of the string variable to an empty string.
Write a code in the main function that would call Function 1 and Function 3 of the Lab class. You can use values of your choice for function arguments (if required). Please write the output of these function calls. class Lab {    int time; public:    Lab(){                                                //Function 1        time = 120;        cout << "Duration of lab is " << time << “minutes” << endl;    }    void Demonstration(){                                 //Function 2        cout << "Lab Demonstration started." << endl;    }    Lab(int duration){                                    //Function 3        time = duration;        cout << "Duration of lab is " << time << “minutes” << endl;    }    ~Lab(){                                               //Function 4        cout << "Thanks. Lab has ended." << endl;    } };
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning