를 호출하고 있습니다 :생성자 코드에서 두 번
//file main.cpp
LINT a = "12";
LINT b = 3;
a = "3";//WHY THIS LINE INVOKES CTOR?
std::string t = "1";
//LINT a = t;//Err NO SUITABLE CONV FROM STRING TO LINT. Shouldn't ctor do it?
//file LINT.h
#pragma once
#include "LINT_rep.h"
class LINT
{
private:
typedef LINT_rep value_type;
const value_type* my_data_;
template<class T>
void init_(const T&);
public:
LINT(const char* = 0);
LINT(const std::string&);
LINT(const LINT&);
LINT(const long_long&);
LINT& operator=(const LINT&);
virtual ~LINT(void);
LINT operator+()const; //DONE
LINT operator+(const LINT&)const;//DONE
LINT operator-()const; //DONE
LINT operator-(const LINT&)const;//DONE
LINT operator*(const LINT&)const;//DONE
LINT operator/(const LINT&)const;///WAITS FOR APPROVAL
LINT& operator+=(const LINT&);//DONE
LINT& operator-=(const LINT&);//DONE
LINT& operator*=(const LINT&);//DONE
LINT operator/=(const LINT&);///WAITS FOR APPROVAL
};
호출 3 호선 대신 할당 optor의 ctor에에. 왜? 나는 일부 서버에서 전체 솔루션을 uppload하려고합니다. 그렇지 않으면 여기에 모든 것을 넣기가 어렵습니다. 나는 또한 비디오 파일을 업로드 할 수 있습니다. 또 다른 한가지는이 할당 자 optor를 구현할 때이 optor가 이미 obj 파일에 있다는 오류가 발생하고 있다는 것입니다. 무슨 일이야?
"="연산자의 구현을 게시 할 수 있습니까? – Simon
'LINT' 란 무엇입니까? 왜'#pragma once'와'#include '전에 LINT a = "12"? 어떤 함수에서든지 변수를 바꿀 수는 없습니다. –
@Alexey Malistov 죄송합니다.이 코드는 두 가지 다른 파일에서 언급해야합니다. 그것을 고칠 예정이다. –