继承与动态内存分配
Posted achao123456
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了继承与动态内存分配相关的知识,希望对你有一定的参考价值。
#include <iostream> #include <cstring> using namespace std; class base { private: char *label; public: virtual ~base(); base(); base(char *s); base(const base &b); const base &operator=(const base &b); virtual void print(); }; base::~base() { cout<<"class f destructor"<<endl; delete [] label; } base::base() { label = new char[1]; label[0] = ‘