dot (.
), arrow (->
).
private
.
public
.
Default memberwise assignment (performed by the assignment operator).
friend
.
initialized.
static
.
this
.
const
.
default constructor.
non-static
.
before.
::
scope resolution operator.
Error: Destructors are not allowed to return values (or even specify a return type) or take arguments.
Correction: Remove the return type void
and the parameter int
from the declaration.
Error: Constructors are not allowed to return values.
Correction: Remove the return type int
from the declaration.
Error: The class definition for Example
has two errors. The first occurs in function getIncrementedData
. The function is declared const
, but it modifies the object.
Correction: To correct the first error, remove the const
keyword from the definition of getIncrementedData
. [Note: It would also be appropriate to rename this member function, as get functions are typically const
member functions.]
Error: The second error occurs in function getCount
. This function is declared static
, so it’s not allowed to access any non-static
class member (i.e., data).
Correction: To correct the second error, remove the output line from the getCount
definition.