Assignment 2 (Release 0.1): Q & A

From CDOT Wiki
Revision as of 12:24, 13 October 2012 by Peter.liu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Q & A

Q: How do you use "void release(void**);" with a (char*) array?
A: You can do it by casting your array as a (void**) and using the '&' operator to send the address of the array pointer
Example:

char* cBuffer;
cBuffer = new char [9001];
release((void**)&cBuffer);

Submitted by: Julian Burton & Jordan Theriault

Q: Are we able to toggle the border's visibility or are we only able to toggle the frame's visibility? If yes, the constructor does not receive any information about the visibility of the border, do we assume that the border is visible?
Question Submitted by: Gideon Thomas and Marie Karimizadeh
A: Yes, we do get to toggle the border visibility by using the

 void bordered(bool);
method which "sets the visibility of the border to the value received". The frame has no border if it is a fullscreen frame, should be safe to assume it has a border if it is not fullscreen (unless otherwise specified).

Answer Submitted by: Team42

Q: In the functions void row(int) and void col(int), are we receiving the values of row and column respectively that are relative to the parent frame or relative to the console screen?
Question Submitted by: Gideon Thomas and Marie Karimizadeh
A: In a CFrame class description most modifiers came in pairs with queries, like

void row(int) - sets the top row to the value received

int row() const - returns the top row position relative to the parent frame, if any; 0 if fullsreen



void col(int) - sets the left column to the value received

int col() const - returns the left column position relative to the parent frame, if any; 0 if fullsreen

So it's safe to assume that modifiers void row(int) and void col(int) will receive coordinates of top-left corner (row and col respectively) of the current frame relative to the parent frame.
Answer Submitted by: 010101000110010101100001011011010011010000110010

Q: What value do abscol() and absrow() return?
A: They return the current Frame's coordinates relative to the console, not the parent frame.
View this example
The red represents the values you want to return, the coordinates relative to the console itself. The black represents the coordinates relative to the parent frame, these are not the ones you want.
Submitted by: Danny Perrone and Michael LaMonaca

Q: In the display(const char*) function of the CFrame class, we are not sent any information about where in the frame to print the string so where do we print it?
A: Since the position to print the string is not given, we print the string at the top left corner of the frame to whatever can fit in the frame. We do this by invoking the display() function from assignment 1.
Submitted by: Gideon Thomas and Marie Karimizadeh

Q: Is there anything by the name virtual constructor?
A: In C++, there is concept of virtual destructor only.No virtual constructors in c++ as constructor requires exact type and as we know virtual function deals with polymorphic behavior of objects.
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2

Q: Can we create references of abstract classes ?
A: By Abstract we mean classes that have atleast one pure virtual function.We cannot create objects of abstract class but Yes references of abstract classes can be created.
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2

Q: Since we can have a potential of unlimited frames within frames, how can we tell how many frames are in the console? (how far down in the frames within frames)
Question Submitted by: Wesley Hamilton and Joe Higginson
A: You can use this simple function to calculate the number of parents within parents of the current frame:

int SomeClass::number_of_parents(){

    return (parent ? 1+parent->number_of_parents() : 0);

    //"parent" is a reference to the parent of the current frame

}

But you can't know how many children the current frame has, unless you create special class members to keep/calculate that number.
Answer Submitted by: Team0x2Au


Q: How does the capture function work?
A: It sets the position to which ever area the character is to receive and calls a method called .get character(). This is a method that was not introduced to zus but it is inside the capture function.
Submitted by: Shavauhn and Elsi, Team 6

Q: Can you call a method on the most derived class if using multiple inheritance and the two bases has the same name?
A: Yes you can but need need to use :: to deal with the ambiguity between the class. So you would call base::method()
Submitted by: Shavauhn and Elsi, Team 6

Bug Reports

* In the given a2test_1_cframeBORLAND executable given as a reference to work on, if you move the outer frame all the way to the top right corner(or in such a way that it overlaps with Moving! ESC: exit), press ESCAPE, and then move the same frame again to the top left corner(or anywhere not previously occupied by Moving! ESC: exit), and then ESCAPE again, you will notice that a part of the frame is still visible on the part of the screen that used to contain the Moving... string. This is not the desired output.
Submitted by: Gideon Thomas and Marie Karimizadeh

* In the given a2test_1_cframeBORLAND, if the console buffer is set to a number greater than the size of the console window, the outer frame goes outside it's limits. This can be solved by setting the buffer to the size of the window in the console properties.
Submitted by: John D and Anson Tan

Possible/Challenging Enhancements

Features Proposed by Team42

  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 (Warning! Platform Dependent Code)
  4. Cursor Visibility - you can toggle the cursor visibility (Warning! Platform Dependent Code)
  5. Timer - to keep track of how long the user has been running your custom main
  6. Files - Read string from file, use that string for editing, then write the result string to that file, overwriting original
  7. Child Tracking - each frame keeps/updates number and an array of addresses of children frames within it.