C++ class method, returns vector<subclass>
问题 I'm having a bit of trouble with a method I'm trying to write for a class. I have class symbol and class terminal. class terminal extends class symbol, but one of the methods of class symbol needs to return a vector. E.g.: #ifndef SYMBOL_H #define SYMBOL_H #include "terminal.h" #include <vector> using namespace std; class symbol { public: vector<terminal> first(); virtual void polymorphable(); }; #endif With class terminal defined: #ifndef TERMINAL_H #define TERMINAL_H #include "symbol.h"