how do I print out subclass object and int sega int nintendo bool enjoy and string fun
hi there
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
template<class gamer>
class game
{
private:
protected:
int nintendo;
int sega;
string fun;
bool enjoy;
public:
};
template<class gamer>
class cookies : public game<gamer> {
public:
cookies() {}
cookies(std::string description)
: description(description)
{ }
std::string description;
};
int main()
{
template<class gamer>
std::vector<cookies> vec(5);
template<class gamer>
vec[0] = cookies("Tasty");
template<class gamer>
vec[1] = cookies("Delicious");
template<class gamer>
vec[2] = cookies("Yummy");
template<class gamer>
vec[3] = cookies("Hungry");
template<class gamer>
vec[4] = cookies("Full");
return 0;
}
| |
Topic archived. No new replies allowed.