Topic List | Page List: 1 |
---|---|
Topic | Let's make some AI-generated stories :D |
Trumble 09/27/21 4:11:50 PM #47: | Fucking hell, it can even write --- class Fart { public: // C++ doesn't seem to allow a default constructor. Why is that? Fart() { cerr << "A very unusual fart.\n"; } virtual ~Fart() { cerr << "Nooooooo!\n"; } }; class FartEatingPanda : public Fart { public: // We only need to define one method. The base class will take care of // the rest. virtual void eatIt() { cerr << "Pfft, you can't touch this.\n"; } }; void printTheInfo(Fart& f) { cerr << "Name of object:\t" << f.name << endl; cerr << "Class of object:\t" << f.klass << endl; cerr << "Does it eat?:\t" << (f.klass == FartEatingPanda::klass()) << endl; cerr << "Size of object:\t" << (f.klass == FartEatingPanda::klass()) << endl; } int main() { Fart f; FartEatingPanda fp; printTheInfo(f); printTheInfo(fp); } --- Me fail Trumble? That's unpossible! ... Copied to Clipboard! |
Topic List | Page List: 1 |