Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //DLLGeo source files
- #include "CubeGeometricCalc.h"
- //Defining member function outside of class
- void CubeGeometricCalc :: SetGeometricAttributes(float inSide1, float inSide2, float inRadius){
- m_Side = inSide1;
- m_Height = inSide2;
- m_Radius = inRadius;
- }
- float CubeGeometricCalc :: CalculateSurfaceArea()
- {
- /*m_SurfaceArea = m_Side*m_Height;*/
- return(6 * m_Side*m_Height);
- };
- float CubeGeometricCalc :: CalculateVolume()
- {
- /*m_Volume = m_Side*m_Side*m_Height;*/
- return(m_Side*m_Side*m_Height);
- };
- ---------------------------------------------------------------
- //cylindergeometriccalc
- #include "CylinderGeometricCalc.h"
- //Defining member function outside of class
- void CylinderGeometricCalc :: SetGeometricAttributes(float inSide1, float inSide2, float inRadius){
- m_Side = inSide1;
- m_Height = inSide2;
- m_Radius = inRadius;
- };
- float CylinderGeometricCalc:: CalculateSurfaceArea()
- {
- /*m_SurfaceArea = (2*PI*m_Radius*m_Height)+(2*PI*m_Radius*m_Radius);*/
- return((2 * PI*m_Radius*m_Height) + (2 * PI*m_Radius*m_Radius));
- };
- float CylinderGeometricCalc::CalculateVolume()
- {
- /*m_Volume = PI*m_Radius*m_Radius*m_Height;*/
- return(PI*m_Radius*m_Radius*m_Height);
- };
- --------------------------
- //DLLGeo.cpp
- #include <iostream>
- using namespace std;
- // IMPORTANT: DLLTEST_API will perform an export of the exposed functions
- #define DLL_EXPORT
- // Include the header, must come after #define DLL_EXPORT
- #include "DLLGeo.h"
- #include "CubeGeometricCalc.h"
- #include "SphereGeometricCalc.h"
- #include "CylinderGeometricCalc.h"
- extern "C"
- {
- DLLTEST_API IGeometricCalc* NewObject(int operation)
- {
- if (operation == 0){
- return new CubeGeometricCalc();
- }
- else if (operation == 1){
- return new SphereGeometricCalc();
- }
- else if (operation == 2){
- return new CylinderGeometricCalc();
- }
- else{
- return NULL;
- }
- }
- DLLTEST_API void DelObject(IGeometricCalc *pObject)
- {
- delete pObject;
- }
- }
- -----------------------------------
- //spheregeometriccalc.h
- #include "SphereGeometricCalc.h"
- //Defining member function outside of class
- void SphereGeometricCalc:: SetGeometricAttributes(float inSide1, float inSide2, float inRadius){
- m_Side = inSide1;
- m_Height = inSide2;
- m_Radius = inRadius;
- }
- float SphereGeometricCalc :: CalculateSurfaceArea()
- {
- /*m_SurfaceArea = 4*PI*m_Side*m_Side;*/
- return(4.0 * PI*m_Radius*m_Radius);
- };
- float SphereGeometricCalc :: CalculateVolume()
- {
- /*m_Volume = (4.0/3.0)*PI*m_Radius*m_Radius*m_Radius;*/
- return((4.0 / 3.0)*PI*m_Radius*m_Radius*m_Radius);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement