1. The operator overloading: operator ==
2. class inheritance and derivation: class derived class name: public base class name
A base class and a derived class
following member function is implemented CKCon derived class
is the base class member function implementation CGirl following
access control inheritance and
type of inheritance
基类与派生类的指针:
pointer to the base class can be a base class object. Derived class pointer can point to a derived class object. Base class pointer can point to a derived class objects, but can not be accessed by members of the derived class pointer to the base class. Pointer can not point to a derived class of the base class object. The following is a base class pointer may point to a derived object
below the base class can be a pointer member access the base class pst
following base class pointer to the derived class member pst inaccessible
following derived class pointer is not pointing to the base class object
3. The polymorphic class: abstract class
Polymorphism literally means a variety of forms, when there is a hierarchy between classes, and inheritance among classes is through the association may be used polymorphism. C ++ polymorphism is that when the member function is called, may perform different functions according to the type of object to call a function
on the note FIG p1 is the base class pointer, p2 is a derived class pointer to
a parent class virtual function to subclasses of the same name, calls the sub-class the show () method
a pure virtual function = 0
the following specific implementations do not function in the base class pure virtual function, but requires to send generated class must have the same name as the function and the actual code to compiled
below as C ++ data abstraction, in fact, using the Interface i.e. when a member function calls the private member variable, the user does not know which variable tone
4. Network Knowledge: tcp
5.socket:send/recv
socket communication process
. server: 1 to buy a mobile phone (create socket)
2. card inserted into the phone (bind local information)
3. set the phone to ring mode (so that the socket becomes active passive; the listen)
4. wait for others to phone
server:
client:
a communication port server to bind the
specified server ip address client
communications port of the client program specifies the service side of the
following is a send function
the following is a recv function
transport structure
点对点聊天:
if the server receives the client's message is a "bye" to end the communication
Here is a remote Internet server, a local virtual machine as a client
under the window ipconfig
, , curl ipinfo.io
C
C封装socket:
can only be a function of the program package: client connecttoserver function:
server initserver function:
C++封装socket:
the connecttoserver functions and function as initserver class member functions
client:
server: