#include #include "Command.h" using namespace std; class LspConnection : Connection { public: explicit LspConnection(int Id, int lspPreference, int pathId); ~LspConnection() { } const int getLspId() { return lspId; } const int getLspPreference() { return preference; } const int getLspPathId() { return pathId; } private: int lspId; int preference; int pathId; }; LspConnection::LspConnection(int Id, int lspPreference, int lspPathId) { printf ("Creating an LSP\n"); lspId = Id; preference = lspPreference; pathId = lspPathId; } class deleteNetworkObject : public Command { public: explicit deleteNetworkObject(LspConnection* lsp); ~deleteNetworkObject(); virtual void Execute(); private: LspConnection* connection; }; deleteNetworkObject::deleteNetworkObject(LspConnection* lsp) { connection = lsp; } void deleteNetworkObject::Execute() { //Delete the LSP components starting with the LSP printf("Deleting LSP ID %d\n", connection->getLspId()); //Delete the LSP preference printf("Deleting LSP Preference %d\n", connection->getLspPreference()); //Delete the LSP path ID printf("Deleting LSP Path ID %d\n", connection->getLspPathId()); } deleteNetworkObject::~deleteNetworkObject() { } int main() { LspConnection* lsp = new LspConnection(1, 0, 1); deleteNetworkObject* deleteObject = new deleteNetworkObject(lsp); deleteObject->Execute(); delete lsp; delete deleteObject; return 0; }