oop_in_c/Square.h

46 lines
954 B
C
Raw Normal View History

2012-04-30 18:59:30 +04:00
#ifndef __SQUARE_H__
#define __SQUARE_H__
#include "Figure.h"
typedef struct Square_data
{
double a;
} Square_data;
2012-05-01 00:55:56 +04:00
struct Square;
2012-04-30 18:59:30 +04:00
typedef struct Square_interface
{
Figure_interface;
2012-05-01 00:55:56 +04:00
void (*resize) (struct Square *this, double a);
double (*diag_length) (struct Square *this);
2012-04-30 18:59:30 +04:00
} Square_interface;
2012-05-01 00:55:56 +04:00
void Square_constructor (struct Square *this, double a);
void Square_destructor (struct Square *this);
void Square_copy (struct Square *to, struct Square *from);
struct Square* Square_clone (struct Square *this);
void Square_destroy (struct Square *this);
const char* Square_type (struct Square *this);
void Square_draw (struct Square *this);
double Square_area (struct Square *this);
void Square_resize (struct Square *this, double a);
double Square_diag_length (struct Square *this);
2012-04-30 18:59:30 +04:00
/* public */
typedef struct Square
{
Square_interface *vtable;
Square_data;
} Square;
2012-05-01 00:55:56 +04:00
struct Square* Square_new (double a);
2012-04-30 18:59:30 +04:00
#endif // __SQUARE_H__