Essay
The following program has been partitioned into two files.The command line command for compiling this is CC B.cpp A.cpp,where CC is the name for your command line compiler.For VC++ this is CL,for Borland,this is BCC32,and for the GNU C++ compiler,this is g++.If you use an IDE (integrated development environment)you would have to place both these files in your project then click the compile button.
Predict the output and explain your prediction.
// This goes in file A.cpp
namespace
{
int func(int i)
{
return i*3;
}
int junk (int i)
{
return i*func(i);
}
// This goes in file B.cpp
#include <iostream>
int func(int i)
{
return i*5;
}
int junk(int i);//from A.cpp
int main()
{
cout <<"func(5)= " << func(5)<< endl;
cout <<"junk(5)= " << junk(5)<< endl;
}
Correct Answer:

Verified
func(5)= 2...View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q15: In a particular file,the names from the
Q16: A namespace is a collection of name
Q17: Suppose the following code is embedded
Q18: What is the problem that the C++
Q19: We are interested in providing a class,say
Q21: You can use the static qualifier with
Q22: A namespace is just a class with
Q23: The scope of a using directive or
Q24: You can use #define to define a
Q25: You want to use only one name,funct1,from