git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@80 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2009-02-10 11:54:34 +00:00
parent a3c550f572
commit 118c03fa8b
2 changed files with 23 additions and 18 deletions

View File

@ -24,8 +24,12 @@
using namespace reactphysics3d;
// Constructor
Body::Body(Kilogram mass) : mass(mass) {
Body::Body(Kilogram mass) throw(std::invalid_argument) : mass(mass) {
// Check if the mass is different from zero
if (mass.getValue() == 0) {
// We throw an exception
throw std::invalid_argument("Exception in Body constructor : the mass has to be different from zero");
}
}
// Copy-constructor

View File

@ -21,6 +21,7 @@
#define BODY_H
// Libraries
#include <stdexcept>
#include "../physics/physics.h"
// Namespace reactphysics3d
@ -37,7 +38,7 @@ class Body {
Kilogram mass; // Mass of the body
public :
Body(Kilogram mass); // Constructor
Body(Kilogram mass) throw(std::invalid_argument); // Constructor
Body(const Body& body); // Copy-constructor
virtual ~Body(); // Destructor