47 lines
816 B
C++
47 lines
816 B
C++
#include <iostream>
|
|
#ifndef DIALER_HH
|
|
#define DIALER_HH
|
|
|
|
#include "Button.hh"
|
|
|
|
#define DEFAULT_NUMBER_BUTTONS 12
|
|
|
|
class Dialer {
|
|
public:
|
|
|
|
Dialer() {
|
|
std::cout << "Dialer Constructor " << this << std::endl ;
|
|
init();
|
|
}
|
|
Dialer(const Dialer& other) {
|
|
std::cout << "Dialer Copy Constructor " << this << std::endl ;
|
|
|
|
init(other.buttons_size);
|
|
// Copy the buttons
|
|
for ( int i = 0; i < other.buttons_size; i++ ) {
|
|
buttons[i] = other.buttons[i];
|
|
}
|
|
}
|
|
~Dialer() {
|
|
std::cout << "Dialer Destructor " << this << std::endl ;
|
|
delete[] buttons ;
|
|
}
|
|
|
|
private:
|
|
|
|
void init()
|
|
{
|
|
this->init( DEFAULT_NUMBER_BUTTONS );
|
|
}
|
|
void init( int num_buttons )
|
|
{
|
|
buttons_size = num_buttons;
|
|
buttons = new Button[buttons_size];
|
|
}
|
|
|
|
Button* buttons ;
|
|
int buttons_size;
|
|
|
|
} ;
|
|
|
|
#endif
|