<div dir="ltr">hi<br><br>i have encountered a problem with g++<br><br>i have a class a, with forward declaration of a function "do_something" and a constructor a(int val);<br>i implement them in a cpp file.<br><br>
g++ complains of redefinition of the constructor but not of the do_something() function.<br><br>why ?<br><br>files:<br>== a.h ===<br>class a {<br>int m_a;<br> a (int val);<br> void do_somthing()<br>}<br><br>== a.cpp ===<br>
#include "a.h"<br>a::do_somthing {a.m_a++;};<br>a::a(int val):m_a(val) {};<br><br>============<br><br><br>any idea ?<br><br><br><br></div>