|what does the data structure want ? list array? some example provide ?|
publicmember functions (which could be called form outside (externally) the class) while
privatemember functions can only be used inside (internally) the class
|what does this mean?|
newarray of the required size (
count) and copy all items (from
object) to that array and return the array. That's all.
Item. name it set or Set (as in the requirement proposed)
ItemNamegood for? It's not within your requirement?
countis neither static nor public (it determines how many items
objectcontains). A better name for
objectwould be Item
numOfItem()should return int,
DetermineItem()(a better name would be FindItem() though).
int DetermineItem(T item);or better
int DetermineItem(const T &item);
object, compare each item (with ==) return -1 if that item cannot be found and the index of the item otherwise.
newarray with size(
count) . it's in a new member function?
ItemNameu said it's not needed?
|i not really get how to compare with a looping|
RemoveItem();: both require the parameter
addNewItem();adds the item only when
RemoveItem();removes the item only when
FindItem()returns not -1
|so how to add the record if without the ItemName?|
Item[will be increase or
countwill be increase ? by the way . the name that i pass in for the title is an
object //class ?]it's not a normal variable right?
size_t. no problem with that. it's basically
unsigned int. I'd prefer
intbecause you can use negative values.
|this is for which function already ? and sorry for it.|
|when add the item. is the Item[ will be increase or count will be increase ?|
countof course. it's easy, really. Didn't i show it already:
|the name that i pass in for the title is an object //class ?] it's not a normal variable right?|
string title;would rather find it's place in that
case. It must remain valid for the entire program. while
titlecould be local for each
|for the case 3 . can i just declare|
|i need to overload the == and != operator for the object class so my template based set class can determine membership|
|so how should i declare the number of item of the set?|
because at start i already set the fix sized for N as 100;
if i get the N . the result of N will always 100.
countis the number of items.
Nis only the upper limit
|isn't for each Item Type ?|
Item == set.Itemcompares only the pointers of the array. (a typical pitfall for beginners)
|so your template based set class can properly determine membership|
Item == set.Itemis wrong in [almost] any case. You need a loop.
|Question 2 :|
Determine if an item is a member of the set. is mean to
FindItem() and display it only right?