Making a new API for ease in future programs

Hey guys, i'm getting a little more advanced into the language of C++ now (and also starting java) and one of the first things in java you learn is how to create an API for your objects, however this is not taught in C++ and i'm simply wanting to know how to create my own API in C++.

Do i just simply make a file full of any functions i want to be in the new API, or do i need to add any keywords to make them work, or perhaps there is something else i need todo? (which is why i'm asking in the first place).

This may be as simple as yes/no but thanks to anyone that helps...
closed account (zb0S216C)
SatsumaBenji wrote:
"one of the first things in java you learn is how to create an API for your objects"

An API is used by other programs or users to interact with your program, or library. Are you referring to the member functions of an object? Because that's called an interface.

Here's the difference between the two:

API
1
2
3
void api_call_a();
void api_call_b();
// ... 

Interface
1
2
3
4
5
6
7
class Something 
{
    public:
        void interface_call_a();
        void interface_call_b();
        // ...
};

Which one?

Wazzak
Application Programming Interface.

It's just the member functions that you make for your classes and programs.

Let's say you write a DirectX Engine in c++ and someone says "Hey can I get the API for this?" Sure, that's easy. Just hand them all the functions that your framework has - return types, input types etc.

So from what I can gather - wherever you are learning java or reading to learn java they stress building the API of a program. Though, you already probably did it in c++. You just didn't have the word API thrown around.

Just know that your interface you build for your classes and objects is the same thing as the API you'd make. and that other programmers will ask for the API and not the interfaces(well they could, API is just more commonplace).
OK guys i get ya, cheers for the help.
As you said i probably have read it in C++ but i couldn't remember it that well (although i suppose it is simple really)
Topic archived. No new replies allowed.