-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
80 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,82 @@ | ||
#ifndef Person_HEADER_Task1 | ||
#define Person_HEADER_Task1 | ||
|
||
#include <iostream> | ||
using namespace std; | ||
|
||
class Person { | ||
char* Name; | ||
int Age; | ||
char Gender; | ||
public: | ||
Person(char* = NULL, int = 0, char = '\0'); | ||
Person(const Person&); | ||
~Person(); | ||
Person& operator = (const Person&); | ||
|
||
void eat(); | ||
void walk(); | ||
/** Person class to define persons in a C++ code. | ||
* | ||
* #include "Person_Task1.h" <BR> | ||
* -llib | ||
* | ||
*/ | ||
#ifndef PERSON_TASK1_H | ||
#define PERSON_TASK1_H | ||
|
||
// SYSTEM INCLUDES | ||
#include<iostream> | ||
|
||
|
||
// Person class definition | ||
class Person { | ||
public: | ||
// LIFECYCLE | ||
/** Default + Overloaded constructor. | ||
*/ | ||
Person(char* = NULL, int = 0, char = '/0', char* = NULL); | ||
|
||
/** Copy constructor. | ||
*/ | ||
Person(const Person&); | ||
|
||
/** Destructor. | ||
*/ | ||
~Person(); | ||
|
||
/** assignment operator. | ||
*/ | ||
Person& operator =(const Person&); | ||
|
||
|
||
const char * getName()const; | ||
}; | ||
|
||
#endif | ||
// OPERATIONS | ||
/** function that depicts eating of Person. | ||
* | ||
* @param void | ||
* | ||
* @return void | ||
*/ | ||
void Eat(); | ||
|
||
/** function that depicts walking of Person. | ||
* | ||
* @param void | ||
* | ||
* @return void | ||
*/ | ||
void Walk(); | ||
|
||
// ACCESS | ||
// setters | ||
void SetName(char* = NULL); | ||
void SetAge(int = 0); | ||
void SetGender(char = '/0'); | ||
virtual void SetDesignation(char* = NULL) = 0; | ||
void SetPerson(char* = NULL, int = 0, char = '/0'); | ||
/** | ||
# @overload void SetPerson(const Person& aPerson); | ||
*/ | ||
void SetPerson(const Person& aPerson); | ||
|
||
// getters | ||
char* GetName() const; | ||
int GetAge() const; | ||
char GetGender() const; | ||
const Person& GetPerson()const; | ||
|
||
// DATA MEMBERS | ||
protected: | ||
char* mDesignation; | ||
|
||
private: | ||
char* mName; | ||
int mAge; | ||
char mGender; | ||
}; | ||
// end class Person | ||
#endif | ||
// _PERSON_TASK1_H_ |