Difference between revisions of "Assignment 2 (Release 0.2): Q & A"

From CDOT Wiki
Jump to: navigation, search
(Q & A)
(Q & A)
Line 19: Line 19:
 
'''Question Submitted by:''' Team 15<br>
 
'''Question Submitted by:''' Team 15<br>
 
'''A:''' Good observation! Declare the data parameter without using the const keyword. Indeed, the data parameter should NOT be declared as a const string because it could be EDITED! <br>
 
'''A:''' Good observation! Declare the data parameter without using the const keyword. Indeed, the data parameter should NOT be declared as a const string because it could be EDITED! <br>
 +
* Adding to that, the same applies to the CLabel class constructor, it will now take a char* str argument instead of const char* str. - Team 15
 
'''Answer Submitted by: pliu''' <br><br>
 
'''Answer Submitted by: pliu''' <br><br>
  

Revision as of 18:20, 5 November 2012

Q & A

Question by: Team # 3
For CButton, it says it needs to be a clickable button.
My question is, how do you record said click.
While looking this up on cplusplus.com and google, all i could find were examples with the windows API.
Is that what we're supposed to use to record the click action?
A: Since we are not building a Graphical User Interface (GUI), we change the label of a CButton object to indicate that the button has been "clicked." For a demo, run the execuatable code posted on the Practical Guidelines wiki page. (pliu}

Q: The CField constructor receives a bool value that stores the border's visibility. The guidelines say that it passes all but one value to its base class constructor, CFrame. However, the CFrame constructor does not take an argument for the border's visibility and only takes one for the frame's visibility. How would we send this as an argument to the base class constructor?
A: We can use the bordered(bool) function of the CFrame class to assign the border's visibility.
Submitted by: Team 15

Q: The CLabel::draw(int) function receives a parameter that indicates the border's visibility i.e. C_NO_FRAME or C_FULL_FRAME. However, the specifications state that a label is never bordered, so how would we make use of the parameter passed through this function?
Question Submitted by: Team 15
A: No, the parameter value will NOT be used for drawing a CLabel object.
Answer Submitted by:pliu

Q: The CLine constructor (the first one which takes the line's data as a parameter) is supposed to pass this parameter's address directly to the CField constructor (according to the specifications) which takes a void* data argument. But, since the data parameter in CLine has const attached to it, we cannot send it to the CField constructor. How would we resolve this?
Question Submitted by: Team 15
A: Good observation! Declare the data parameter without using the const keyword. Indeed, the data parameter should NOT be declared as a const string because it could be EDITED!

  • Adding to that, the same applies to the CLabel class constructor, it will now take a char* str argument instead of const char* str. - Team 15

Answer Submitted by: pliu

Q: What is the size of void pointer?
A: Pointer variables always contain the address of variable.so size of pointer is independent of its type. Size of pointer depends on the environment. On 32-bit environment size of pointer is 4 bytes.
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2

Q: Does declaring virtual function in class increase the size of object of class?
A: Any class that is having virtual function has a vtable associated with it. So that class contains a vptr(virtual pointer) containing a base address of that vtable. Hence size of any object of that class is increased by one pointer variable.
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2

Bug Reports

Possible/Challenging Enhancements

Features Proposed by Team 42

  1. Smart word wrapping - words are not cut off mid-word while wrapping
  2. Optimization - "test" compiled executables have efficiency issues when moving boxes around
  3. Colors - you can add color to the test program if you're making your own main
  4. Timer - to keep track of how long the user has been running your custom main
  5. Files - Read string from file, use that string for editing, then write the result string to that file, overwriting original