Skip to content

Instantly share code, notes, and snippets.

@draganczukp
Created April 5, 2018 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save draganczukp/5b3d43a1ea2315d4738e278e7764d160 to your computer and use it in GitHub Desktop.
Save draganczukp/5b3d43a1ea2315d4738e278e7764d160 to your computer and use it in GitHub Desktop.
throw.cpp
class Kurczak{
private:
float cena;
float waga;
// int data produkcji;
// Datę pomijam bo zbędna
public:
Kurczak(float cena, float waga, int data){
if(cena > 0) this->cena = cena; else throw new Exception("Zła cena");
if(waga > 0 && waga < 10) this->waga = waga; else throw new Exception("Zła waga");
// To samo dla daty
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment