Using function of a class inside another class

At this moment i'm learning how to write a library, to make my code look a lot cleaner.

However, when i was making my library, i need to make use of another library called
#include <SoftwareSerial.h>

But how do initialise an instance of this library inside my class?

My header file

#ifndef Verzenden_h
#define Verzenden_h

#include "Arduino.h"
#include <SoftwareSerial.h>

class Verzenden
{
  public:
    Verzenden(int rxPin, int txPin);
    void send(String data);
  private:
    int _rxPin;
    int _txPin;
    int _setPin;
    int _enPin;
    int _fiveV;
    SoftwareSerial _APC(int rxPin, int txPin);
    
};

#endif

My c++ file:

#include "Arduino.h"
#include "Verzenden.h"
#include <SoftwareSerial.h>

Verzenden::Verzenden(int rxPin, int txPin)
{
  _APC(rxPin, txPin);
  _APC.begin(9600);
}

void Verzenden::send(String data){
  _APC.send("test");
}

I get the following error:

sketch\Verzenden.cpp: In constructor 'Verzenden::Verzenden(int, int)':

Verzenden.cpp:14: error: '((Verzenden*)this)->Verzenden::_APC' does not have class type

   _APC.begin(9600);

   ^

sketch\Verzenden.cpp: In member function 'void Verzenden::send(String)':

Verzenden.cpp:18: error: '((Verzenden*)this)->Verzenden::_APC' does not have class type

   _APC.send("test");

   ^

exit status 1
'((Verzenden*)this)->Verzenden::_APC' does not have class type

Anyone any clue how to do this?

Here's one way. I did it all in a single .ino file because it's faster to check. But, you can/should split it into .h, .cpp, and .ino files for actual use as a library.

BTW, others will surely chime in to tell you that using the String class is stupid. Go with c-strings (i.e. null-terminated char arrays).

#include "Arduino.h"
#include <SoftwareSerial.h>

class Verzenden
{
  public:
    Verzenden(int rxPin, int txPin);
    void begin(uint16_t baud);
    void send(const String &data);
  private:
    int _rxPin;
    int _txPin;
    int _setPin;
    int _enPin;
    int _fiveV;
    SoftwareSerial _APC;

};

Verzenden::Verzenden(int rxPin, int txPin) : _APC(rxPin, txPin) {}

void Verzenden::begin(uint16_t baud) {
  _APC.begin(baud);
}

void Verzenden::send(const String &data) {
  _APC.print(data);
}

Verzenden xxx(4, 5);
void setup() {
  xxx.begin(9600);
  xxx.send("Test");
}

void loop() {}

Or:

#include "Arduino.h"
#include <SoftwareSerial.h>

class Verzenden : public SoftwareSerial
{
  public:
    Verzenden(int rxPin, int txPin);
  private:
    int _setPin;
    int _enPin;
    int _fiveV;

};

Verzenden::Verzenden(int rxPin, int txPin) :  SoftwareSerial(rxPin, txPin) {}

Verzenden xxx(4, 5);
void setup() {
  xxx.begin(9600);
  xxx.print("Test");
}

void loop() {}

This works for me, thanks man!

Now i just have one other question:
In this example we include one external library, say for example i wanted to add another external library

What whould i have to do to this peace of code

Verzenden::Verzenden(int rxPin, int txPin) : _APC (rxPin, txPin){
  
}

to add an instance instance of _TEST(VALUE1, VALUE 2)
How do i add this so the _APC and the _TEST are both there?

Google "C++ initializer lists" and read til you understand what's going on there.