// @topic T51002 Miscellaneous small samples developed in class // @brief 10/02/2012 -- Sensor class constructor/destructor #include <iostream> #include <string> #include <vector> // sensor.h class Sensor { bool state; public: Sensor(); Sensor( bool initial_state ); ~Sensor(); };//class Sensor // sensor.cpp Sensor::Sensor() { state = false; } Sensor::Sensor( bool initial_state ) { state = initial_state; } Sensor::~Sensor() { std::cout << state << " sensor got destroyed\n"; } int main() { Sensor sence( true ); Sensor* ptr_device = new Sensor[ 5 ]; delete[] ptr_device; return 0; }