git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@80 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
a3c550f572
commit
118c03fa8b
|
@ -24,8 +24,12 @@
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
||||||
// Constructor
|
// 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
|
// Copy-constructor
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define BODY_H
|
#define BODY_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
|
#include <stdexcept>
|
||||||
#include "../physics/physics.h"
|
#include "../physics/physics.h"
|
||||||
|
|
||||||
// Namespace reactphysics3d
|
// Namespace reactphysics3d
|
||||||
|
@ -37,7 +38,7 @@ class Body {
|
||||||
Kilogram mass; // Mass of the body
|
Kilogram mass; // Mass of the body
|
||||||
|
|
||||||
public :
|
public :
|
||||||
Body(Kilogram mass); // Constructor
|
Body(Kilogram mass) throw(std::invalid_argument); // Constructor
|
||||||
Body(const Body& body); // Copy-constructor
|
Body(const Body& body); // Copy-constructor
|
||||||
virtual ~Body(); // Destructor
|
virtual ~Body(); // Destructor
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user