Search

вторник, 18 октября 2011 г.

CLabel

Ok, it's been a while! Let's program something again! So, what do we have today? A kind of Idea of what is supposed to be in the end AND that I'm going write something for it... And eventually it will work... Or not... I hope it will.
But what I need to do today is write a bunch of small functions, constructors, and I just finished the destructor. It's funny and interesting how thing work - lot's of people come together and each and every one of them write a specific function, and possibly some of them don't even know what the purpose of their part is, but in the end, if everything is one by the plan - Program Works! It's like a small, micro, model of society... But, I got off the track a bit. What I'm planning to do today:
1. Write/Double-check the most basic functions (1-2 lines)
2. Update my knowledge on difference between "." and "->"
3. Walk though rest of the functions and see if I have any questions and, possibly, write them down, or remember.
So, let's start...


I just Love OOP - "editable() - always return false"
bool CLabel::editable()const {
return false;
The PERFECT function. I guess it's gonna be used in the future but seriously, why not just "return false;". And the best part is - there WILL be a place to use this function.

Ok, so, questions we have for today are:

Description: "CLabel(const char *Str, int Row, int Col, int Len = 0) - passes the Row and Col to the CField constructor and then.... etc"
Line: CField a (trow, tcol);
Problem: I got an Error "object of abstract class type "CFrame" is not allowed", so, how can I pass values to the constructor if it's object's creation is not allowed?


Description: "draw(int fn) - makes a direct call to console.display(), passing _data for the string to be printed and... etc"
Line: temp.display(_data, CFrame::absRow(), CFrame::absCol(), _length);
Problem: Don't know how to target an information where _data points, also, "a direct call" has a bit of a problem, since I can't use Console::draw, and I'm pretty sure, that Creating a temp class for the small task is a bit... Stupid wrong.


Description: "edit() - calls draw"
Line: draw();
Problem: Not sure if I should use "this->draw()", or just "draw()", I guess once tester is out I can check, but the problem still exists.



And that's it so far.