How to initialize SoftwareSerial in a class in another Library

This might be a silly question but I have forgotten my C/C++ classes a long time ago. I am trying to create a library for my GPRS shield and I want to include the SoftwareSerial object inside the new object I will be creating. The header file would include I presume the declaration of the class member:

class SMS
{
  public:
    SMS();
    void begin();
    SoftwareSerial smsSerial;
    
  private:  
  
}

The constructor for SoftwareSerial have to be passed the RX and TX pins. And I want these to be parameters of a function, maybe begin:

SMS::SMS()
{
  smsFlags = B00000000;
}

void SMS::begin(int rxPin, int txPin)
{
  smsSerial = new SoftwareSerial(rxPin,txPin); //<---- Is this what I'm supposed to do?
}

Not sure if I should use “new” or not.

I think the 'new' will work, but is often avoided. The 'new' will allocate memory, which makes it harder to detect when the Arduino has run out of ram memory. You want Rx and Tx pin to be variables, so you have no choice and must use 'new'.

But why on earth would you want the Rx and Tx pins to be variables? Perhaps there is a different solution for that.

Right, just as I suspected. The reason I wanted to pass the pin numbers as a parameter is to have a library that is independent of the selected pins for the serial communications. That way you don't have to modify the library files if you select different pins for the software serial.