Sameed Tariq
Sameed Tariq

Reputation: 81

Merging Two Libraries in C++

I have two separate libraries with different functionalities like A.h and B.h. I want to combine these both libraries into App.h

When the user declare the instance of App Class. How should it knows that it has to create the instance of A.h or B.h

Upvotes: 0

Views: 50

Answers (1)

uceumern
uceumern

Reputation: 937

Are you looking for a factory?

Assuming A and B are classes and share a common interface (C), your App class can do something like this:

static C create_A_or_B()
{
    if (...)
        return A()
    else
        return B()
}

Upvotes: 1

Related Questions