.. (לתיקייה המכילה) | ||
In the assignment description there is a mistake in the example of order relation for conjunction. | |
It should be: a * d * e * g > – a * d The assignment was fixed accordingly. |
In the assignment description there is a copy-paste mistake in the C++ delete function declaration. | |
It should be: void operator delete(void* p, size_t s) |
In the main.cpp file should the allocated variables be freed? | |
The main shows you only the operations that should be supported, there is no memory management there (in assignment tests it will be, of course). |
Whose responsibility is to open and close memory.txt file? | |
You need to open and close file, each time you want to write something to it. |
Who is bigger between literals '-a' and '-b'? | |
First the check according to letter and then according to sign. So if a < b, then a < -b, -a < -b, -a < -b |
Conjunction& operator*(Conjunction&) | |
Yes. Also new instance is created in: Literal::operator - (Literal&) DNF::operator + (DNF&) DNF::operator * (DNF&) DNF::operator - (DNF&) operator - (Conjunction&) and so on |
Can we use dynamic_cast<T*>? | |
Of course |
Is it ok if my program has memory leaks, in way the user won't be able to handle? | |
No, if in the main function is built in right way (variable for each operation) all the memory should be freed after the program execution. And allocated memory should be 0 for each class in memory.txt. |
How can I make a copy of literal for inserting to the list, if Literal is abstract class? | |
You can check the real type of literal and call the appropriate C'tor/Copy C'tor. But also you can define your own function Literal* clone() that returns appropriate copy for Positive and Negative using dynamic binding. |
If the dry part is instead of the memory leaks check (creating memory.txt)? | |
No, it just says that for given main you can't receive 0 memory. There is main for which you can receive 0 bytes for each class. Literal& a = *new Positive('a'); Literal& b = *new Positive('b'); Literal& c = -b; Conjunction& c1 =*new Conjunction(a); Conjunction& c2 =*new Conjunction(b); Conjunction& c3 = c2 * c; DNF& d1 = c1 + c3; DNF& d2 = -d1; delete &a; delete &b; delete &c; delete &c1; delete &c2; delete &c3; delete &d1; delete &d2; |
Should we define new/delete operators for the Literal class (even if it is abstract) ? | |
No |
For those who implemented list according to the tutorial slides (first example). | |
There is bug in slide 15. 'first' should be assigned to dummy element of the list and not to the first real element of the list (reset should be changed appropriately). |
In Conjunction's operator < | |
Yes |