const methods
Michael Hoennig
Michael_Hoennig at hh.maus.de
Sun Jun 23 08:06:00 AEST 1991
Hi Marina,
MG> virtual int f() const;
MG>Does anybody know the meaning of this const postfix ??
this method will not change the object to which this is pointing.
If you will use const parameters of a class, you can only access
these const-methodes:
class X
{
int n;
public:
...
void theConst() const;
void theOther();
...
};
void foo( const X aX )
{
X.theConst(); // allowed
X.theOther(); // not allowed, type mismatch error or warning
}
Adios
--
Michael Hoennig -- Dobbelersweg 45 -- D-2000 Hamburg 26 -- ++49 40 219 24 58
office: mi1 at starlab.UUCP -- ++49 40 23 08 56 (StarDivision Hamburg)
More information about the Comp.lang.c
mailing list