Original Post
🔒 Locked
Universal Project Scope
Advertisement
Use the extern keyword.
MyList.hpp
MyList.cpp
[edited by - dcosborn on November 25, 2003 5:40:22 AM]
MyList.hpp
#include <list>
// Makes the variable visible to whoever includes the header.
extern std::list myList;
MyList.cpp
#include "MyList.hpp"
// Here's the declaration of our variable - it exists within
// MyList.cpp, but its accessible using extern.
std::list myList;
[edited by - dcosborn on November 25, 2003 5:40:22 AM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement