I'm new to programming, and i have a big problem with C++ classes, or more importently, including the classes in my main.cpp file.
I have 2 files in one folder, main.cpp and myclass.cpp
The myclass.cpp one works fine, but i just can't put its functions into the main.cpp scope! I tried to use the old ".h" headers, but that makes things even MORE complicated and it doesn't work either. From what i understand, the .h files are an outdated C feature, so in C++ you should be able to include non-.h files.
Here are the 2 files:
main.cpp
Code:
#include <iostream>
#include <myclass>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
myclass.cpp
Code:
#include <iostream>
using namespace std;
class myclass
{
public:
myclass();
virtual ~myclass();
protected:
private:
};
myclass::myclass()
{
//ctor
}
myclass::~myclass()
{
//dtor
}
//More functions will go here
I tried lots of things:
#include <myclass.cpp>
#include "myclass"
#include "myclass.cpp"
But all failed.
Any help on this one?