Say I have a file file1.h:

namespace a
{
     int Func()
    {
        return 5;
    }
}

and a file file2.h

#include "file1.h"

namespace a
{
    class Foo
    {
        Foo();
    };
}

and file2.cpp:

#include "file2.h"

a::Foo::Foo()
{
    Func();//<----
}

Can Func() be referenced like this, or do we need to do a::Func()?

Recommended Answers

All 2 Replies

since you did not declare the using clase you will have to declare the namespace in which Func() exists, that is a::Funct()

Alright, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.