plorg.h
#ifndef PLORG_H_#define PLORG_H_const int Len = 19;class plorg{ private: char name[Len]; int CI; public: plorg(const char* nm = "Plorga" , int ci = 50); ~plorg(); void show()const; void resetCI(int ci);};#endif
plorg.cxx
#include<iostream>#include<cstring>#include"plorg.h"plorg::plorg(const char* nm , int ci){ strcpy(name,nm); CI = ci;}plorg::~plorg(){}void plorg::show()const{ std::cout<<"名称:"<<name<<std::endl; std::cout<<"CI指数:"<<CI<<std::endl;}void plorg::resetCI(int ci){ CI = ci;}
main.cxx
#include"plorg.h"int main(){ plorg A; A.show(); A.resetCI(Len); A.show();}
转载请注明原文地址: https://ju.6miu.com/read-15246.html