Hopefully a quick question regarding class functions

I have the following class which uses a few classes from a third party lib:

1
2
3
4
5
6
7
8
9
10
#include <thirdparty.h>
// assets.h
class Assets {
  void Load();
}

// assets.cpp
void Assets::Load() {

}


The load function relies on a couple of functions from thirdparty.h....but I'd like to only include <thirdparty.h> in assets.cpp instead of in the header file like I did above.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// assets.h
class Assets {
  void Load();
}

// assets.cpp
#include <thirdparty.h>
void Assets::Load() {
  ParseFile(); // this won't work of course..
}

// How can I define this only in .cpp instead of in assets.h?
void ParseFile() {
}


Is there a way I can define and use ParseFile only from the .cpp file so I don't have to define it in the header file and in the process avoid including the 3rd party lib in the header file?

I really hope I made sense :/ Thanks!
Why won't what you have work. It should work.

What kind of error messages are you getting?

Thanks for replying jlb, very sorry, I noticed I was doing this in my real file:

1
2
void Assets::ParseFile() {
}


I removed Assets:: and it's working. Again sorry for the false alarm. Next time I'll make sure to copy the exact code
Last edited on
Topic archived. No new replies allowed.