I have class A:
//A.h
<code>`public:
A();`
</code>
<code>`public:
A();`
</code>
`public:
A();`
//A.hpp
<code>#include "A.h"
A::A(){
std::cout<<"constructor"ף
}
</code>
<code>#include "A.h"
A::A(){
std::cout<<"constructor"ף
}
</code>
#include "A.h"
A::A(){
std::cout<<"constructor"ף
}
I have several places in the code that do an instance of “A” like that:
<code>A a;
</code>
<code>A a;
</code>
A a;
but I get error “one or more multiply defined symbols found“
but when I copy the implamntion of “A” constructor to “A.cpp” or to “A.h” I dont get the error.
what is the problem?
How is it going in cpp?
New contributor
Yael is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.