made this compilable by g++ and fixed undefined virtual functions