Thread: Clarifying this function with the requirements.....

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    93

    Clarifying this function with the requirements.....

    Code:
    IOCheckList::IOCheckList(unsigned int *checkBits, int row, 
    							 int col, int NoOfChecks, const char *displayChars, 
    							 void (*help)(IOScreen *)):IOField(row,col){
    	int i = 0; 
    	this->NoOfChecks = NoOfChecks;
    	strcpy(this->displayChars,displayChars);
    	for(;i<NoOfChecks;i++){ 
    		*checkBits|= (1 << i); 		
    	}
    	data = (void*)checkBits;
        editable = 1;
    
    }
    Public constructor:

    IOCheckList(unsigned int *checkBits, int row, int col, int NoOfChecks,

    const char *displayChars,

    void (*help)(IOScreen *) = NULL);

    this constructor like other IOField’s children passes the values of row and col to the parent constructor. Afterwards it sets the “data” attribute to the value of checkBits parameter. NoOfChecks and displayChars parameters are IOCheckList specific values and are copied into corresponding attributes of the class.. NoOfChecks is the number of checkboxes that are displayed on the screen and also the number of corresponding bits in *checkBits that is tied to the values of the checkboxes. Therefore if the value of NoOfChecks is 5, then five checkboxes will be display()ed and five first bits of *checkBits will be set. the three characters at displayChars will be copied into the displayChars attribute of the class. These characters will be used to show a check box.
    Does my code correspond correctly with the requirements? I am a bit flaky on the bit and pointer stuff.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I don't see you calling display() anywhere.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  3. Brand new to C need favor
    By dontknowc in forum C Programming
    Replies: 5
    Last Post: 09-21-2007, 10:08 AM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM