Before writing, I would like to say something for a technical documentation issued a few days ago. Intravenced CSOCKET Programming Blocks and Non-Blocking Mode Published on 9CBS and VCKBASE: http://dev.9cbs.net/develop/Article / 58/58739.shtmhtp://www.vckbase.com/document/viewdoc/?id=1375 This is a better article I think of writing, and this is my first document published in vckbase, this article The article explained in detail the WINSOCK's working mechanism, remember to write this technical documentation until the middle of the night.
The problem encountered these days: When is a document from 9CBS, when is a defocular argument function to cause my interest, let me know about C : first quote LostMouse translation: Effective C C language standard The elaboration of this problem is very clear: When deleting the object of the derived class through the base class, the base class does not have a false argument function, the result will be unsure. ...... The declaration of the monographic function will bring your own good behavior that you want: Object memory is released, the destructor of derived class Enemytank and base class EnemyTarget will be called. My understanding is that the benefit of defining the sectational function of the base class is the advantage of the virtual function, and after the transition from the derived class type to the base class, it can also ensure that the sectoral and basic classifications of the derived class and the base class are Called! Simple use code description: class a {a () {} Virtual ~ a () {} // defined as a false argument function} Class B: public a {b () {m_psz = new char (256); } // allocate 256 bytes in heap, return the first address m_psz ~ b () {delete m_psz;} // Concentration Release stack char * m_psz;} int Main (int Argc, char * argv [ ]) {A * p = new b; // 1 delete p; // 2 return 0;} 1. Pointer P of the derived class B is converted to the base class A pointer. 2. Quote: "C Primer": The virtual function mechanism only works as expected when using pointers and references. (Pan Ai People Translation) In the case of defining the destructuring function of class A, it can determine the destructor in which the p-call is determined in the case where the picked function is runtime. Actual destructuring process: The destructor of the derived class B is called first, and then the destructive function of the base class A.