28 Sep This assignment is an exercise in creating a “wrapper” class. A wrapper class is implemented by using a composition relationship and exporting only those functionalities required by the design
Introduction
The Object Oriented software model provides for both inheritance and composition
techniques for program design. Each has its advantages and disadvantages.
Assignment Description
This assignment is an exercise in creating a “wrapper” class. A wrapper class is
implemented by using a composition relationship and exporting only those functionalities
required by the design. In contrast, with inheritance all public members of the base class
are exported for use. Hence the composition relationship provides the means to customize
the behavior of the class object, and at the same time leverage the capabilities of the
already existing contained class.
In particular, this assignment creates a wrapper around the deque template class. Rather
than generalizing, which is the way we create reusable code, we will specialize and create
a list class containing strings. In practice storing and manipulating strings dominates
much of what is done by applications.
Program Requirements
1. The student will create the implementation for a class called SList. The interface for
the SList class will be provided with all applicable method declarations.
2. The student will create the implementation for the associated enumerator called
SListEnum, which is also declared in the file SList.h.
3. Each of the methods for both class and enumerator will be implemented using
“inline” functions. These inline functions will be included in the SList.h file.
4. The student will create a test driver to test each of the methods defined in the class.
The test driver file will be called TestSList.cpp.
5. The student will submit the source file for the test driver, TestSList.cpp, and the
SList.h file.
6. The student will “zip” only the source files for submission. The name of the zip file
will be “program1_studentlastname.zip”.
#ifndef SLIST_H_
#define SLIST_H_
#include
#include
class SListEnum;
class SList
{
public:
SList();
SList(const char* filename);
SList(const SList& L);
~SList();
const char* Add (const char*);
const char* Add (const std::string&);
SList& Move (SList& L,bool append=false);
void Sort (bool nodup=false); void Unique (); void Empty ();
SList* Split (const char* ,const char* delimiter);
const char* Join (std::string&,const char* delimiter); const char* Has (const char*);
void Read (const char* filename);
void Write (const char* filename);
bool operator==(SList&);
bool operator!=(SList&); SList& operator= (SList&);
SList& operator<<(const char* item);
friend class SListEnum;
const int count;
private: std::deque strlist;
}; //End of class SList
class SListEnum { public:
SListEnum (); SListEnum (SList& L);
SListEnum (SList* L);
~SListEnum();
void operator=(const SList& L);
void operator=(const SList* L);
void operator=(const SListEnum&);
bool hasMore();
const char* getNext();
private:
};
// IMPLEMENTATION GOES HERE
#endif
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.