oop_in_c/Square.h

46 lines
990 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);
2012-05-01 11:30:29 +04:00
double (*diag_length) (const 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);
2012-05-01 19:56:48 +04:00
void Square_copy (struct Square *dest, const struct Square *src);
2012-05-01 11:30:29 +04:00
struct Square* Square_clone (const struct Square *this);
2012-05-01 00:55:56 +04:00
void Square_destroy (struct Square *this);
2012-05-01 11:30:29 +04:00
const char* Square_type (const struct Square *this);
void Square_draw (const struct Square *this);
double Square_area (const struct Square *this);
2012-05-01 00:55:56 +04:00
void Square_resize (struct Square *this, double a);
2012-05-01 11:30:29 +04:00
double Square_diag_length (const struct Square *this);
2012-04-30 18:59:30 +04:00
/* public */
typedef struct Square
{
Square_interface *vtable;
Square_data;
} Square;
2012-05-01 02:17:26 +04:00
Square* Square_new (double a);
2012-04-30 18:59:30 +04:00
#endif // __SQUARE_H__