<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body dir="ltr" bgcolor="#ffffff" text="#000000">
Erez D wrote:
<blockquote
cite="mid:6c32b540904260538p67110a41g201376834971856d@mail.gmail.com"
type="cite">
<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>
</div>
</blockquote>
Send an actual couple of files. What you sent is impossible to debug (I
doubt g++ does not complain that do_somthing is defined with no return
type and no parenthesis).<br>
<br>
Shachar<br>
<pre class="moz-signature" cols="72">--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
<a class="moz-txt-link-freetext" href="http://www.lingnu.com">http://www.lingnu.com</a>
</pre>
</body>
</html>