Next: Semantic errors
Up: Syntactic mistakes
Previous: C/C++
- Declaring a static member variable, but not reserving space for it in
the implementation of the class. This will result in an error when
linking:
/tmp/cca001861.o(.text+0x4): undefined reference to `A::Aint'
.
- No
;
at the end of a class definition. Can result in lots of
compile errors.
- Forgetting to write the classname in front of the function name in
the implementation of that member function, for example
int insert_element() { .. }
instead of
int set::insert_element() { .. }
.
- Defining a member function like
int foo() const;
and implementing it as
int bar::foo() { ... }
. The const
should also be added to the
function-header of the implementation.
SE Praktikum
Tue Aug 13 11:13:23 MET DST 1996