[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Assigning values to namespace members
From: |
Peter Oberberg |
Subject: |
Assigning values to namespace members |
Date: |
Fri, 08 Feb 2008 12:35:02 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Hello all!
Maybe I did not understand something fundamental about namespaces,
because I cannot make out the following behaviour.
Please consider the following code snippet (it is a simplified version
of what I want to do, in order to reproduce the error, actually the
namespace declaration is in a separate header file).
// ==================================================
// Begin C++ code, file TTest.cc
namespace TTest
{
int value;
};
TTest::value = 1;
// End C++ code
// ==================================================
When compiling this file with
$ g++ -c TTest.cc
I receive the error message
"TTest.cc:9: error: expected constructor, destructor, or type \
conversion before ‘=’ token"
So where am I wrong in thinking, that TTest::value is an entity, I can
assign values to outside the namespace?
Thank you in advance for explanations!
Peter
- Assigning values to namespace members,
Peter Oberberg <=