strngbadfixed.h

来自「一本很好的C++学习的丛书!初学者必看的」· C头文件 代码 · 共 23 行

H
23
字号
// strngbad.h -- flawed string class definition
#include <iostream>
using std::ostream;
#ifndef STRNGBAD_H_
#define STRNGBAD_H_
class StringBad
{
private:
    char * str;                // pointer to string
    int len;                   // length of string
    static int num_strings;    // number of objects
public:
    StringBad(const char * s); // constructor
    StringBad();               // default constructor
    StringBad(const StringBad &); // copy constructor
    ~StringBad();              // destructor
    StringBad & operator=(const StringBad &);
    // friend function
    friend ostream & operator<<(ostream & os, 
                       const StringBad & st);
};
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?