Serving the Quantitative Finance Community

 
User avatar
king
Topic Author
Posts: 0
Joined: March 24th, 2002, 2:56 pm

C++ problem

July 3rd, 2003, 7:50 am

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.
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

C++ problem

July 3rd, 2003, 7:54 am

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);}
 
User avatar
king
Topic Author
Posts: 0
Joined: March 24th, 2002, 2:56 pm

C++ problem

July 3rd, 2003, 7:59 am

..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...
 
User avatar
king
Topic Author
Posts: 0
Joined: March 24th, 2002, 2:56 pm

C++ problem

July 3rd, 2003, 8:11 am

//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
 
User avatar
slevin
Posts: 1
Joined: January 5th, 2003, 5:11 am

C++ problem

July 3rd, 2003, 4:24 pm

i am willing to bet that the warning would dissappear if you make constructors in both classes explicit.
 
User avatar
king
Topic Author
Posts: 0
Joined: March 24th, 2002, 2:56 pm

C++ problem

July 3rd, 2003, 6:31 pm

spot on ! thats what I was just about to say...
 
User avatar
king
Topic Author
Posts: 0
Joined: March 24th, 2002, 2:56 pm

C++ problem

July 4th, 2003, 6:52 pm

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 ?
 
User avatar
mj
Posts: 12
Joined: December 20th, 2001, 12:32 pm

C++ problem

July 6th, 2003, 6:21 pm

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