-8
클래스 선언 외부에 parameters-initialize리스트가있는 클래스 생성자의 정의를 넣을 수없는 이유는 무엇입니까?C++, 클래스 선언 외부에 클래스 생성자의 정의를 넣을 수없는 이유는 무엇입니까?
typedef unsigned int UINT;
class num_sequence {
public:
typedef vector<UINT>::iterator iterator;
//I cannot put this following part in the cpp file
num_sequence(vector<UINT> & ele,int len=0,int beg=0):_relems(ele),_length(len),_beg_pos(beg)
{
//an abstract class cannot be instanlized
cout<<"build a num_sequence object";
}
virtual ~num_sequence();
num_sequence :: num_sequence ( 벡터 및 ELE, INT LEN = 0, INT BEG = 0) : _ relems (ELE), _ 길이 (len), _ beg_pos (beg) \t \t { \t \t \t // 추상 클래스 도태 할 수 없습니다. \t \t \t cout << "build a num_sequence object"; } –
클래스 선언 범위 내에 생성자를 구현할 수 있지만 외부에서 오류가 발생합니다 –
외부에 넣을 수 있습니다. 문제가 있다면 시도한 실제 코드를 게시하면 작동하지 않습니다. –