중첩 된 전략 패턴을 만들려고했습니다. 중첩 된 부모 클래스를 완전히 가상으로 만들 때와 같은 오류가 발생합니다. 이 아이디어는 가능한가?C++ 중첩 된 전략 patterne, 순수 가상 오류
예 : 다음 오류
class Jacobi {
private:
mat _V, _A;
int _n, _rotations;
public:
class DiagAlg {
public:
virtual void diagonalize() = 0;
};
class Cyclic : DiagAlg {
public:
void diagonalize();
};
vec getE();
mat getV();
mat getA();
int getRotations();
Jacobi(Jacobi::DiagAlg DA);
Jacobi(const mat& A); // could be done without user supply of base vectors
bool rotate(int p, int q);
};
Resulst는 :
jacobi.h:28:26: error: cannot declare parameter ‘DA’ to be of abstract type ‘Jacobi::DiagAlg’
jacobi.h:15:9: note: because the following virtual functions are pure within ‘Jacobi::DiagAlg’:
jacobi.h:17:16: note: virtual void Jacobi::DiagAlg::diagonalize()
구현은 원인의 CPP 파일 것이다.
주 구현. '_'을 완전히 이끌지 않는 것이 가장 좋습니다. –