#include "iostream"
#include "memory.h"
using namespace std;
class A
{
public:
std::string tostring()
{
std::string buf;
buf.append(std::to_string(major))
.append(" ")
.append(std::to_string(cmd));
return buf;
}
protected:
short major = 7;
int cmd = 79;
};
template<int MAX_SIZE, typename T>
class B {
public:
std::string tostring()
{
std::string buf;
for (int i = 0; i < end(mbuf)-begin(mbuf); i++){
buf.append(std::to_string(mbuf[i])).append(" ");
}
buf.append(std::to_string(m_len));
return buf;
}
char mbuf[MAX_SIZE];
int m_len;
};
class C : public A{
public:
static const unsigned short MAJOR = 7;
static const unsigned short MAINOR = 66;
static const unsigned short CMD = 819;
std::string tostring()
{
std::cout &
c++ 尽量不要用memset去对类的实例清0
最新推荐文章于 2023-09-07 17:14:39 发布