在C++中,有时在类定义中,公共成员首先被声明,稍后会被私有.但变量或数据成员通常是私有的,并由公共方法使用.因此,在这种情况下使用变量但尚未声明.因此代码变得难以理解.但我发现知名程序员,网站或书籍后来宣布私人会员.有谁知道是什么原因?
#include "Includes.h"
enum BlowfishAlgorithm
{
ECB,
CBC,
CFB64,
OFB64,
};
class Blowfish
{
public:
struct bf_key_st
{
unsigned long P[18];
unsigned long S[1024];
};
Blowfish(BlowfishAlgorithm algorithm);
void Dispose();
void SetKey(unsigned char data[]);
unsigned char Encrypt(unsigned char buffer[]);
unsigned char Decrypt(unsigned char buffer[]);
char EncryptIV();
char DecryptIV();
private:
BlowfishAlgorithm _algorithm;
unsigned char _encryptIv[200];
unsigned char _decryptIv[200];
int _encryptNum;
int _decryptNum;
};
class GameCryptography
{
public:
Blowfish _blowfish;
GameCryptography(unsigned char key[]);
void Decrypt(unsigned char packet[]);
void Encrypt(unsigned char packet[]);
Blowfish Blowfish;
void …Run Code Online (Sandbox Code Playgroud)