lundi 29 août 2016

Using A Class within my program C++

I am a fairly new programmer. I am trying to implement a function to add an Element to my list, (which is use bit-strings to represent a set for small positive integers [0, 64))

Here is my Class class SmallSet { public: SmallSet(): set(0) {} bool addElement(unsigned long); // add a new element to the set. No-op if input is invalid. bool deleteElement(unsigned long); // delete an element from the set. No-op if not a member. bool isMember(unsigned long); // test membership unsigned numElements(); // returns the cardinality of the set void printElements(); // prints members from smallest to largest.

private: unsigned long set; // internal representation of our set.

SmallSet &operator=( const SmallSet &);   // disallow assignment
SmallSet( const SmallSet &);              // disallow copy-constructor

};

// My function i am using is called

bool addElement(unsigned long x) // add a new element to the set. No-op if input is invalid. {

} I am trying o pass an element into the set/ add an element what is the proper way to do this, Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire