in working on this pgm, i have made notes to myself ... questions that keep popping up. if anyone wants to clarify some of these concepts for me ....
1. are TRUE and FALSE keywords? if a method says
return (TRUE);
will it work?
2. const on END of method declaration and const IN the parameter of the method declaration ...
sometype somemethod (const sometype& x) const
what do both of these do? are they basically INSURANCE ... just be sure the method won't change the parameter passed in and ... ?
3. does the deconstructor happen at the end of the pgm automatically. i know that you need to manually delete things sometimes ... like in an assignment ... but does the
virtual ~ClassName(); deconstructor somehow automatically called on all objects that have been created at the end of method main?
4. scenario 1
int* d_array;
d_array = NULL;
this is read as d_array points to an int and the object that d_array points to is NULL (which would be 0 in the case of an int) ... is that right?
scenario 2
int* d_array;
*d_array = NULL;
what does this say? would it cause an error? is the '*' only used when declaring a pointer?
5. what is the proper way to do the & and * ...
int *d_array; or
int* d_array;
6. i am confused with the usage of "this" and "self" in C++.
could someone "read" both of these to me (i still have to make a sentence out of statements and methods to understand them and draw a mental picture).
C& C:: operator = (const C& rhs)
{
if (*this == rhs)
return *this;
...........
}
and then there is this one .....
C& C::operator = (const C& rhs)
{
if (this == &rhs)
return *this;
..............
}
and then there is this one .....
C& C:: operator = ( const C& rhs){
if (this == &rhs)
return (self);
}
i think they all do the same thing (check for assignment to itself) ... but i am unsure about the *this vs self and &rhs stuff ... so basicaly i am confused by the whole thing.
7. the use of "new". is that basically only done in a constructor?
THANKS SO MUCH ... you guys have already been so much help to me. i am on a crash course!
crq