Hi guys, I found the solution to the problem. While debugging further, I found out that the virtual destructor ~AppData() was being called. Then I realized that I was instantiating the object of class PQR as follows: PQR pkt(arguments); whereas, the instantiation should have been PQR* pkt = new PQR(arguments); The former method resulted in pkt variable going out of scope at the end of the instantiating function, whereas, it does not happen in the latter method.
regards, Swaroop --- On Mon, 1/6/09, Swaroop Shere <swaroopsh...@yahoo.co.in> wrote: From: Swaroop Shere <swaroopsh...@yahoo.co.in> Subject: [ns] Packet::copy() issue with ns2.33 To: "ns-users" <ns-users@ISI.EDU> Date: Monday, 1 June, 2009, 8:43 PM From: swaroopsh...@yahoo.co.in <swaroopsh...@yahoo.co.in> Subject: Packet::copy() issue with ns2.33 To: "ns-users" <ns-users@ISI.EDU> Date: Monday, 1 June, 2009, 1:22 PM Hi, I am writing a new protocol in NS2 and using application level data packets by extending AppData. So I have class ABC:: public AppData and class PQR::public ABC. I have defined the size() and copy() methods for both, and also defined the constants in packet.h in enum AppDataType. Now, when I run the simulation, I get an error that says... ----------------------------------------------------------------------- pure virtual method called terminate called without an active exception ----------------------------------------------------------------------- Upon debugging, I found out that this error comes when it executes Packet::copy(), specifically the statement p->data_ = data_-> copy() here, data_->copy() happens to be a pure virtual function, which is why I am getting the error, but I am wondering what is the cause.. I have defined the proper copy() functions for new AppData types... It would be great if someone points me out my mistake.. If someone wants more information about my code, I would be happy to share it ... thank you, regards, Swaroop Explore your hobbies and interests. Click here to begin. Explore and discover exciting holidays and getaways with Yahoo! India Travel http://in.travel.yahoo.com/ Explore and discover exciting holidays and getaways with Yahoo! India Travel http://in.travel.yahoo.com/