about .h and .cpp file

videostream.cpp
1
2
3
4
5
6
7
8
9
class VideoStream {
	static std::vector<PChunk> chunk_list;  ///< The vector of all chunks diffused through the overlay
	static size_t current_chunk_id;			///< The ID of the next chunk to be output from the stream
	static size_t num_chunks;				///< The number of chunks in the whole stream
	static std::list<VideoStreamCallback> callbacks;  ///< Callback function list
public:
	/// Get the number of chunks in the video stream
	static size_t get_num_chunks();


videostream.h

1
2
3
4
5
6
7

#include "videostream.h"

std::vector<PChunk> VideoStream::chunk_list;
size_t VideoStream::current_chunk_id = 0;
size_t VideoStream::num_chunks = 0;
std::list<VideoStreamCallback> VideoStream::callbacks;


in these two files
there are duplicate variables definition
what is the mechanism behind this?

is it similar to define a variable in .c
and declare it using "extern" keyword in .h file?
thanks
Topic archived. No new replies allowed.