lundi 12 août 2019

How to instantiate a class within an C++ implementation file?

I am trying to make use of some features of a third-party tool written in C++ and thought to just create a make file and include the sources of the tool. That was easy enough, but then I ran into some class declarations that were nested in an implementation file (*.cpp).

The problem is, I would like to make use of those class declarations but not sure how. I have this *.cpp file in a library now and would like to include AClass in my app sources and link against this library.

Here is an example of how the file (cclass.cpp) in this package is laid out.

#include "cclass.h"

class AClass { ... };

int ClassC::getNumber() 
{
    AClass ac;
    int num = ac.useIt();

    return num;
}

Is there a way to include AClass in my app and have this app link against a library which has cclass.cpp in it?

Aucun commentaire:

Enregistrer un commentaire