Advertisement
AI_UBI

Physical Properties

Dec 24th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. #ifndef PHYS_PROP_H
  2. #define PHYS_PROP_H
  3.  
  4. template<typename Type>
  5. class PhysProp
  6. {
  7. protected:
  8.  
  9.     Type mass = 0, friction = 0, bouncy = 0;
  10.  
  11. public:
  12.  
  13.     PhysProp() {};
  14.     PhysProp(const Type &, const Type &, const Type &);
  15.     ~PhysProp() {};
  16.  
  17.     void setFriction(const Type &);
  18.     Type & getFriction() const;
  19.  
  20.     void setMass(const Type &);
  21.     Type & getMass() const;
  22.  
  23.     void setBouncy(const Type &);
  24.     Type & getBouncy() const;
  25. };
  26.  
  27. template<typename Type>
  28. inline PhysProp<Type>::PhysProp(const Type &m, const Type &f, const Type &b)
  29. {
  30.     this->mass = m;
  31.     this->friction = f;
  32.     this->bouncy = b;
  33. }
  34.  
  35. template<typename Type>
  36. inline void PhysProp<Type>::setMass(const Type &m)
  37. {
  38.     this->mass = m;
  39. }
  40.  
  41. template<typename Type>
  42. inline Type & PhysProp<Type>::getMass() const
  43. {
  44.     return this->mass;
  45. }
  46.  
  47. template<typename Type>
  48. inline void PhysProp<Type>::setFriction(const Type &f)
  49. {
  50.     this->friction = f;
  51. }
  52.  
  53. template<typename Type>
  54. inline Type & PhysProp<Type>::getFriction() const
  55. {
  56.     return this->friction;
  57. }
  58.  
  59. template<typename Type>
  60. inline void PhysProp<Type>::setBouncy(const Type &b)
  61. {
  62.     this->bouncy = b;
  63. }
  64.  
  65. template<typename Type>
  66. inline Type & PhysProp<Type>::getBouncy() const
  67. {
  68.     return this->bouncy;
  69. }
  70. #endif //PHYS_PROP_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement