first commit
This commit is contained in:
49
Lab3/name.cpp
Normal file
49
Lab3/name.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
//name.cpp
|
||||
|
||||
#ifndef __NAME_CPP__
|
||||
|
||||
#define __NAME_CPP__
|
||||
|
||||
#include <iostream.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "name.h"
|
||||
|
||||
//##################################################
|
||||
|
||||
// Name
|
||||
|
||||
// Puts name into a buffer
|
||||
|
||||
//==================================================
|
||||
|
||||
Name::Name(char *txt) {
|
||||
|
||||
buff = new char[strlen(txt) + 1];
|
||||
|
||||
strcpy(buff, txt);
|
||||
|
||||
}
|
||||
|
||||
//##################################################
|
||||
|
||||
// Destructor
|
||||
|
||||
// Delets buffer
|
||||
|
||||
//==================================================
|
||||
|
||||
Name::~Name() {
|
||||
|
||||
delete [] buff;
|
||||
|
||||
}
|
||||
|
||||
//##################################################
|
||||
|
||||
// Operator overload
|
||||
|
||||
// Deletes buffer and makes a new one
|
||||
Reference in New Issue
Block a user