Класс PopcornPopper - Nero-ro/Facade GitHub Wiki

Класс PopcornPopper

Класс PopcornPopper содержит следующие методы:

  • on()
  • off()
  • pop()
  • toString()

Полный код Класса PopcornPopper (.h):


#ifndef POPCORNPOPPER_H

#define POPCORNPOPPER_H

#include

#include

using namespace std;

class PopcornPopper

{

private:

QString description;

public:

PopcornPopper(QString description);
void on();
void off();
void pop();
QString toString();

};

#endif // POPCORNPOPPER_H


2 Часть (.cpp):


#include "popcornpopper.h"

PopcornPopper::PopcornPopper(QString description)

{

this->description = description;

}

void PopcornPopper::on() {

cout << description.toStdString() << " on" << endl;

}

void PopcornPopper::off() {

cout << description.toStdString() << " off" << endl;

}

void PopcornPopper::pop() {

cout << description.toStdString() << " popping popcorn!" << endl;

}

QString PopcornPopper::toString() {

return description;

}


⚠️ **GitHub.com Fallback** ⚠️