Initializing a class instance inside a library?

I'm writing a library to command a custom board. Ideally I'd like to communicate with the board using SoftwareSerial without bothering the user with the details. To do this I'm trying in declare SoftwareSerial mySerial(10,11); in the library. Is there any way to do this? I've tried putting it in the header and in the .cpp file but I can't get the scope to extend beyond the function calling it. Any help would be appreciated.

Sure , why not.

I'm not going to write code from scratch to do it. If you want help fixing your code, then guess what you need to post.

Please read How To Use This Forum first.

I should learn to try one more time. Defined mySerial right after the #includes in the .cpp file and all the functions can see it.

You can specify how to initialize members in the member initializer list:

class Pig {
  public:
    Pig(){Serial.println("Oink");};
    Pig(int numOinks){for(int i = 0; i < numOinks; i++)Serial.println("Oink");};
    void oink(void){Serial.println("Oink");};
    void poo(){crap();};
  private:
    void crap(){Serial.println("Pig Poo");};
};

class Cow {
  public:
    Cow(){Serial.println("Moo");};
    Cow(int numMoos){for(int i = 0; i < numMoos; i++)Serial.println("Moo");};
    void moo(void){Serial.println("Moo");};
    void poo(){crap();};
  private:
    void crap(){Serial.println("Cow Poo");};
};

class Zoo : public Pig, public Cow {  // Take note of the order here and how it affects the construction of the two base classes
  public:
    Zoo(){};
    Zoo(int numOinks, int numMoos) : Pig(numOinks), Cow(numMoos){}; // constructor may pass args to the base classes
    using Cow::poo;
};


void setup() 
{
  Serial.begin(9600);
  Zoo zoo(3, 1);
  Serial.print(F("Making my zoo Oink: "));
  zoo.oink();
  Serial.print(F("Making my zoo Moo: "));
  zoo.moo();
  Serial.print(F("and if my zoo poos, I get "));
  zoo.poo();
}

void loop() {
  // put your main code here, to run repeatedly:

}

look at the Zoo constructor…

Are you declaring it in the global scope or in a static variable?