Hello everyone, :D
It was my understanding that the main file (main.cpp) includes the header file (MyClass.h) which includes the implementation file (MyClass.cpp)
main.cpp-->MyClass.h-->MyClass.cpp
So how come when I select new, class Code::Blocks gave me this
#include LinkedList.h
#include "LinkedList.h"
LinkedList::LinkedList()
{
//constructor
}
LinkedList::~LinkedList()
{
//dtor
}
where the header file is included in the implementation file?
Because your
Quote from: c_weed on October 20, 2010, 12:06:47 AM
[..] understanding that the main file (main.cpp) includes the header file (MyClass.h) which includes the implementation file (MyClass.cpp)
main.cpp-->MyClass.h-->MyClass.cpp
is wrong.
Got it. :)
I thought I got it but didn't after all. I thought you were saying that the implementation file should include its header file, but I thought the main file included the implementation file.
main.cpp-->class.cpp-->class.h
how come this is wrong?
how does including the header from the main file work because doesn't the implementation (class.cpp) not get included?
Quote from: c_weed on October 26, 2010, 01:11:10 AM
how does including the header from the main file work because doesn't the implementation (class.cpp) not get included?
Sorry, but this is no longer within the scope of our forum and violates the forum rules therefore. Please grab yourself a C++ beginners book and read about the basics. Basically sections about how a compiler works, and what a linker does.
Topic locked.