Page 1 of 1

C++ problem

Posted: July 3rd, 2003, 7:50 am
by king
Does anyone know how to resolve the following "warning" I have come across in my C++ program:warning LNK4227: metadata operation warning (00131189) : Inconsistent parameter information in duplicated methods (methods: new; type:<Module&gt: (0x08000147).I am trying to implement a header file in a cpp file. The header file is inherited from another class.

C++ problem

Posted: July 3rd, 2003, 7:54 am
by DominicConnor
I don't recognise this one.My guess is that the compiler is getting upset by something vaguely like:typedef double real;class Cow{public: Cow (double); Cow (real);}

C++ problem

Posted: July 3rd, 2003, 7:59 am
by king
..if I place all my defns in the header file - the warning disappears. If I place my implementation in a cpp file instead (which I want to do) the warning appears...

C++ problem

Posted: July 3rd, 2003, 8:11 am
by king
//in A.hclass A {.....}; ///////////////////////////////in A.cppA::A {.....}//////////////////////////////////in B.hclass B: public A {public: B(....);}; //in B.cpp////////////////////////////B::B(..) : A(...) { ...}B.obj has linking problem

C++ problem

Posted: July 3rd, 2003, 4:24 pm
by slevin
i am willing to bet that the warning would dissappear if you make constructors in both classes explicit.

C++ problem

Posted: July 3rd, 2003, 6:31 pm
by king
spot on ! thats what I was just about to say...

C++ problem

Posted: July 4th, 2003, 6:52 pm
by king
New Problem:Suppose we have a class Base and a class Derived which inherits from Base.vector<Base> b;Derived d();b.push_back(d);Question? is b capable of having polymorphic behaviour ? i.e. can I invoke a virtual member function in Base by indexing the vector that will execute function defined in d ?

C++ problem

Posted: July 6th, 2003, 6:21 pm
by mj
nothe vector is of base class objects -- if base has abstract methods then it won't compile and if it doesn'tthe base class method will be called. if you want to do this you have to define a vector of (possibly smart) pointers to base class objects.MJ