我正在使用具有php 5.2的000webhosting。我收到以下错误: 解析错误:语法错误,第10行/home/a9550001/public_html/ih_lomake/libs/password.php中的意外“{”
整个代码是:
#include <iostream>
#include <vector>
class base_class
{
public:
//base_class(){};
base_class(double a, double b){a_=a; b_=b;}
private:
double a_, b_;
};
class derived_class // <--- no more inheritance (and thus wrong class name)
{
public:
derived_class(int dim) : vector_object(dim, base_class(0,1)){};
std::vector<base_class> print_vector_object() {return vector_object;}
private:
std::vector<base_class> vector_object;
};
int main()
{
int dim = 3;
derived_class abc(3);
std::cout << abc.print_vector_object().size() << std::endl;
return 0;
}