More about const
Posted on 1999-10-27
Hello again C++ Experts.
Well... Every thing is going ok with my beginning in C++.
But 'Const' is being a chalenge to me :-)
Y now this... For instances:
const Wm_Click = 14589... It means that every time I put Wm_click in my code,
it is going to be translated into 14589. (Well... I know I invented Wm_Click
and it's number, it is just an example)
But I don't understand it
What is a const member?.
For instances into a class I saw something like this.
const int C; // A class member I guess.
As I know, if I do something like this:
C = 125; // I get an error... Am I right?.
Could anyone explain me the const member?
How they work, etc...
I tried to do something like this
int const m_meber; //(in base class)
Obviusly it gave me an error:
m_member must be initialized in constructor base/member initializer list.
I don't know what it means... I saw something like this in an example...
I also saw this:
c_class (const c_class& Var)
I know that it is a copy constructor... But why the parameter is declared as
Is it right to say that const warranty that the original class object will not change?... What happen if I don't say 'const'
Thanks to all experts.
P.D: I enjoying learning C++, Well... It is a litle more hard than VB, But
I think it is worth of learning...