![]() |
|
05-31-2012
|
1 |
|
I'm watching...
Join Date: Sep 2011
Location: Northern Ireland, UK
Posts: 644
|
Competent C++ programmers! Questions!
For any of you who are competent with C++, I have a few questions that I need answered, and hopefully you can provide me with them.
These are some of the questions that I can't find on the Internet, and because the C++ group I created seems to be pretty quiet as well, the only place I could really ask these questions was here. |
|
05-31-2012
|
2 |
|
nothin
Join Date: Jan 2012
Location: York
Posts: 1,483
|
found this link about destructors because it sounded intresting http://publib.boulder.ibm.com/infoce...%2Fcplr380.htm you would use a destructor to clean up, the link sort of explains it |
|
05-31-2012
|
3 |
|
Banned
Join Date: Sep 2011
Location: A box
Posts: 3,317
|
Test it out and find out
|
|
06-01-2012
|
4 | |
|
Registered User
Join Date: Apr 2012
Posts: 347
|
ifdef and endif are preprocessor commands. If I were to write something like #ifdef WINDOWS_VERSION //Insert platform-specific Windows code here. #endif #ifdef LINUX_VERSION //Insert platform-specific Linux code here. #endif Then I can change the codebase at compile time by defining the flag WINDOWS_VERSION or LINUX_VERSION. In this example, I'd use this so I wouldn't have to have two different project files for a Linux and Windows version, because most of the code is platform-independent anyway. "this" refers to the instance of the class you're working with. If I define a member function for a "car" class that has "wheels" as a variable, I can reference it by using either "wheels" or "this->wheels". If there is another variable in scope with the name "wheels", then "this->wheels" will always refer to the variable associated with the object by which the member function belongs to. |
|