编辑代码

#include <iostream>
#include <string.h>
using namespace std;
class CCourse
{
   private:
        long no;
        char *p_name;
        float credit;
    public:
        CCourse(long no_val,char *p_val,float credit_val);
        ~CCourse(){delete p_name}
        void print() const;

}
class CHLP:public CCourse{
    private:char *p_openby;
    public
        CHLP(long no_val,char *p_val,float credit_val,char credit_val)
        {
            p_openby=new char[strlen(p_open)+1];
            strcpy(p_openby,p_open);
        }
        ~CHLP(){delete p_openby;}
        void studyFor(){
            cout<<'Study for structured programming'<<endl;
        }
}
// string 字符串
// 指针要delete