Q:

Difference in using capital and small letters within a structure

When i use the "distance" and "time" as identifier names for my structures, i am getting errors. The compiler says that reference to "distance" is ambiguous.
#include <iostream>
using namespace std;
struct distance{
    float feet;
    float inches;
};
struct time {
    int hrs;
    int mins;
    int secs;
};
int main()
{
    struct tour {
        distance d;
        time t;
    };
    return 0;
}

But when i use the capital letters, "Distance" and "Time", 
#include <iostream>
using namespace std;
struct Distance{
    float feet;
    float inches;
};
struct Time {
    int hrs;
    int mins;
    int secs;
};
int main()
{
    struct tour {
        Distance d;
        Time t;
    };
    return 0;
}

the compiler doesn't show any errors. Can someone tell me the reason?

A:

There is a member named distance and time in the std library. Thus the compiler isn't sure which distance/time you are calling. If you drop your "using namespace std" then you can define your structs in lower case and your code will still work. Otherwise, you would need to redefine the names of your structs, such as capitalizing the first letter.

