Скачиваний:
22
Добавлен:
01.05.2014
Размер:
778 б
Скачать
		// source file name: menu.C
		#include <string.h>
		#include "menu.h"

		int  menu::num_fields = 0;

		// constructor with an argument 
		menu::menu ( const char* str )

		{
			title = new char[strlen(str)+1];

			strcpy (title, str );

			num_fields = 0;

		}

		// constructor with no argument

		menu::menu()

		{

			title = 0;

			num_fields = 0;

		}

		// a destructor 

		menu::~menu()

		{

				delete title;

		}

		// a non-static member function

		void menu::incr_field ( int siz )

		{

			num_fields += siz;

		}

		// a static member function

		int menu::fields()

		{

			return num_fields;

		}

		// another non-static member function. 

		char* menu::name()

		{

			return title;

		}
Соседние файлы в папке ch2