Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cout;
- using std::endl;
- class caract {
- int ID;
- public:
- caract(int id) : ID(id) { }
- ~caract() { }
- int getID() const { return ID; }
- };
- class respira : public caract {
- public:
- respira() : caract(1) { }
- ~respira() { }
- };
- class toxico : public caract {
- public:
- toxico() : caract(2) { }
- ~toxico() { }
- };
- bool operator==(caract* c1, const caract& c2) {
- return (c1->getID() == c2.getID());
- }
- int main() {
- caract* c = new respira;
- if(c == respira())
- cout << "sim" << endl;
- else
- cout << "nao" << endl;
- if(c == toxico())
- cout << "sim" << endl;
- else
- cout << "nao" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement