Code still compile when there is a mis-match in .h and .cpp

ying lcs yinglcs@gmail.com
Wed Feb 21 19:34:00 GMT 2007


Hi,

i am usingn gcc 4.1.0 on RedHat

In my .h file, I declare this:
class A{
public:
    void f1 (const B* bPtr);

};

But In my .cpp, I do this:

void A::f1(B* bPtr) {
 //....

}

My question is I miss 'const' in my implementation (.cpp), why the
code still compile?

Is there an option that I should turn on so that the compile is more standard?

Thank you.



More information about the Gcc-help mailing list