Мой вопрос довольно прост, но я застрял.Как выбрать нужный конструктор из базового класса?
// node.h
#ifndef NODE_H
#define NODE_H
#include <vector>
// definition of an exception-class
class WrongBoundsException
{
};
class Node
{
public:
...
Node(double, double, std::vector<double>&) throw (WrongBoundsException);
...
};
#endif
// InternalNode.h
#ifndef INTERNALNODE_H
#define INTERNALNODE_H
#include <vector>
#include "Node.h"
class InternalNode : public Node
{
public:
// the position of the leftmost child (child left)
int left_child;
// the position of the parent
int parent;
InternalNode(double, double, std::vector<double>&, int parent, int left_child) throw (WrongBoundsException);
private:
int abcd;
};
#endif
// InternalNode.cpp
#include "InternalNode.h"
#define UNDEFINED_CHILD -1
#define ROOT -1
// Here is the problem
InternalNode::InternalNode(double a, double b, std::vector<double> &v, int par, int lc)
throw (WrongBoundsException)
: Node(a, b, v), parent(par), left_child(lc)
{
std::cout << par << std::endl;
}
Я получаю:
$ g++ InternalNode.cpp
InternalNode.cpp: 16: ошибка: объявление 'InternalNode :: InternalNode (double,double, std :: vector> &, int, int) throw (WrongBoundsException) 'выдает различные исключения InternalNode.h: 17: ошибка: из предыдущего объявления' InternalNode :: InternalNode (double, double, std :: vector> &, int, int) '
ОБНОВЛЕНИЕ 0: исправлено пропущенное:
ОБНОВЛЕНИЕ 1: исправлено исключение броска