A School Directory Application
Package to illustrate classes, subclasses, polymorphism,cout<<<overloading, and virtual functions
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
Entry Class Reference

#include <Entry.h>

Inheritance diagram for Entry:
Inheritance graph
[legend]

Public Member Functions

 Entry ()
 
 Entry (std::string first, std::string last, std::string eAddress)
 
bool equals (std::string first, std::string second)
 
bool equals (Entry otherEntry)
 
bool comesBefore (std::string first, std::string second)
 
bool comesBefore (Entry otherEntry)
 
virtual std::ostream & print (std::ostream &os) const
 
virtual ~Entry ()
 

Friends

std::ostream & operator<< (std::ostream &os, const Entry &ent)
 

Detailed Description


Remarks
Entry: a base class for entries within a School Directory * A base entry holds a first name, last name, and email address *
Base capabilities include: * Base constructors * Comparison operations depend upon last names, then first names * Formatted output *
: files include header (Entry.h) and Implementation (Entry.cpp) *
Uncomment a main program for unit testing *
Author
Henry M. Walker *
Date
January 11, 2023 *
Remarks
References *
A School Directory as an Example of Object-Oriented Design * http://localhost/courses/cpp-style-guide/directory/index.php *

Constructor & Destructor Documentation

◆ Entry() [1/2]

Entry::Entry ( )

Remarks
Default constructor (with no parameters) *

Remarks
Entry: a base class for entries within a School Directory * A base entry holds a first name, last name, and email address *
Base capabilities include: * Base constructors * Comparison operations depend upon last names, then first names * Formatted output *
: files include header (Entry.h) and Implementation (Entry.cpp) *
Uncomment a main program for unit testing *
Author
Henry M. Walker *
Date
January 11, 2023 *
Remarks
References *
A School Directory as an Example of Object-Oriented Design * http://localhost/courses/cpp-style-guide/directory/index.php *

Default constructor (with no parameters) *

◆ Entry() [2/2]

Entry::Entry ( std::string  first,
std::string  last,
std::string  eAddress 
)

Remarks
Full-parameter constructor *
Parameters
firsta person's first name *
lasta person's last name *
eAddressa person's email address *

◆ ~Entry()

Entry::~Entry ( )
virtual

Remarks
a Default destructor *
identify as virtual, since Entry has virtual functions *

Remarks
a Default descructor *

Member Function Documentation

◆ comesBefore() [1/2]

bool Entry::comesBefore ( Entry  otherEntry)

Remarks
check if this object comes before the parameter object *
Parameters
otherEntryan entry to be compared with this object *
Returns
true if Entry's first/last names come before parameter's names * in directory order *

◆ comesBefore() [2/2]

bool Entry::comesBefore ( std::string  first,
std::string  second 
)

Remarks
check if this object comes before the given first/last names *
Parameters
firsta person's first name *
lasta person's last name *
Returns
true if Entry's first/last names come before parameter names * in directory order *
Here is the caller graph for this function:

◆ equals() [1/2]

bool Entry::equals ( Entry  otherEntry)

  • Remarks
    check whether first and last names or two Entries match *
  • Parameters
    otherEntryan entry to be compared with this object *
  • Returns
    true if this Entr'sy names match those of the parameter *

    Remarks
    check if this object comes before the given first/last names *
  • Parameters
    firsta person's first name *
    lasta person's last name *
  • Returns
    true if Entry's first/last names come before parameter names * in directory order *

◆ equals() [2/2]

bool Entry::equals ( std::string  first,
std::string  second 
)

Remarks
check whether first and last name of an Entry match two strings*
Parameters
firsta person's first name *
lasta person's last name *
Returns
true if Entry names match first and last name strings *
Here is the caller graph for this function:

◆ print()

std::ostream & Entry::print ( std::ostream &  os) const
virtual

Remarks
output a format Entry object *
Parameters
osoutput stream which will receive the formatted Entry data *
  • @ewmrk by being a virtual function, implementations in subclasses * will be interpreted via polymorphism *
Returns
formatted string on the given output stream *
Remarks
use of a to_string function with a string return type * would require allocating space for a long string, * yielding a potential memory leak *

Reimplemented in Faculty, Staff, and Student.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const Entry ent 
)
friend

Remarks
overload << for printing an Entry *
use of the virtual print method allows tailored output * by subclasses *

The documentation for this class was generated from the following files: