static members, friends and inner classes
1, static member
1. Concept: class members declared as static become static members of the class. Member variables decorated with static are called static member variables, Member functions decorated with static are called static member functions.
class Test {
public:
//Test():m_a(0){}
Test():m_b(0){
}
//Static functions do not have this ...
Posted by fuzzy1 on Sun, 31 Oct 2021 08:12:40 -0700
PTA queue exercise
choice question
2-1 the condition that the circular queue with less one element space (m is the maximum queue length) is full (). A.rear== front B.(rear+1)%m==front C.(rear+1) == front D.front ==(front+1)%m
2-2 the cyclic queue is stored in array A[0... n-1], and its head and tail pointers are f and R respectively. The head pointer f always p ...
Posted by flOid on Sun, 31 Oct 2021 03:45:39 -0700
Boost smart pointer - scoped_ptr
boost::scoped_ptr and std::auto_ptr is very similar. It is a simple smart pointer, which can ensure that the object is automatically released after leaving the scope. The following code demonstrates the basic application of this pointer:
#include <string>
#include <iostream>
#include <boost/scoped_ptr.hpp>
class implementati ...
Posted by rsassine on Sat, 30 Oct 2021 21:46:14 -0700
Special class design, singleton mode
catalogue
1, Please design a class that can only create objects on the heap
2, Designing a class can only create objects on the stack
3, Design a class that cannot be copied
4, Designing a class cannot be inherited
5, When designing a class, only one object can be instantiated
five point one The singlet ...
Posted by jhenary on Sat, 30 Oct 2021 21:30:46 -0700
C++ list container details
Basic concept of list container
Concept: list is a data structure that stores data in a chain, which is called a linked list
Linked list: a discontinuous storage structure on a physical storage unit. The logical order of data elements is realized through pointer links in the linked list Composition of linked list: the linked list ...
Posted by enygma on Sat, 30 Oct 2021 15:29:06 -0700
The fifth day of C + + Learning
1, Multiple choice questions
1. Perform the following procedure
char *str; cin >> str; cout << str; If you enter abcd 1234, output (D) A. abcd B. abcd 1234 C.1234 D. Output garbled code or error
str is a char * pointer, uninitialized, an ...
Posted by Bricktop on Sat, 30 Oct 2021 07:15:45 -0700
5 live555 source code analysis - live555 RTSP workflow
In the last article, we obtained the RTSP communication process through WireShark packet capture. In this article, we analyze the working principle of each process through code. The inheritance relationship of live555 is too complex, so I made a diagram to simply record the class inheritance relationship related to h264 file transfer
1, OPTIO ...
Posted by lip9000 on Sat, 30 Oct 2021 06:52:57 -0700
737-C++STL - principle of container space allocator
Implement a simple vector container
The implementation of all C++ STL containers needs to rely on a spatial configurator allocator. Although we don't pay attention to it when using containers, we have been using it all the time. The C++ STL library provides a simple implementation of the default spatial configurator allocator. Of course, we ne ...
Posted by robin on Sat, 30 Oct 2021 06:31:20 -0700
C + + operator overloading
C + + operator overloading
Operator overloading concept: redefine the existing operators and give them another function to adapt to different data types
Operator overloading can also occur
1. The plus sign operator (+) is overloaded
Function: realize the operation of adding two user-defined data types
code implementation
#include < ...
Posted by sandeep251088 on Sat, 30 Oct 2021 01:11:08 -0700
Structure byte alignment and common body size
1. Structure memory alignment
Structure memory alignment is often asked in written examination and interview, so to make a summary, first verify the memory size of different structures through code:
#include <stdio.h>
struct Node1{
char c1;
int val1;
char c2;
};
struct Node2{
char c1;
char c2;
int val1;
};
struct ...
Posted by scheibyem on Fri, 29 Oct 2021 10:30:18 -0700