#include <iostream>
#include <vector>

struct foo {
	virtual void print() =0;
};

struct goo : public foo {
	int a;
	void print() { std::cout << "goo"; }
};

struct moo : public foo {
	int a,b;
	void print() { std::cout << "moo"; }
};

int main() {
	std::vector<foo> foos;
	foos.push_back(moo());
	foos.push_back(goo());
	foos.push_back(goo());
	foos.push_back(moo());
	
	for(foo& f : foos) {
		f.print();
	}
	return 0;
}