I'm trying to access a function of one class to call in a function of another class.

include <iostream>

include <string>

   #include "string.h"
   #include "mysentence.h"
   //#include "corpus.h"
   #include <algorithm>
   #include <vector>
   using namespace std;


    sentence::sentence( string a ) {
     b = a;

     }

    string sentence::reverse() {
    //string s; 

    b = reverse(b);

   return b;
     }

    string sentence::reverse( string b ) {

    if(b.length() <= 1 )
            return b;
    string last(1, b[b.length()-1]);
    string reversed = reverse(b.substr(0,b.length() - 1));
    return last+reversed;

 }

   char sentence::rotationOf(char input) {

   char a = 'A';
   char a_= 'a';
  char b = 'B';
  char b_= 'b';
  char c = 'C';
  char c_= 'c';
  char d = 'D';
  char d_= 'd';
   char e = 'E';
   char e_= 'e';
   char f = 'F';
   char f_= 'f';
   char g = 'G';
  char g_= 'g';
 char h = 'H';
char h_= 'h';
char i = 'I';
 char i_= 'i';
char j = 'J';
char j_= 'j';
char k = 'K';
char k_= 'k';
char l = 'L';
 char l_= 'l';
 char m = 'M';
  char m_= 'm';
  char n = 'N';
 char n_= 'n';
  char o = 'O';
 char o_= 'o';
 char p = 'P';
 char p_= 'p';
 char q = 'Q';
char q_= 'q';
char r = 'R'; 
char r_= 'r';
char s = 'S';
char s_= 's';
char t = 'T';
char t_= 't';
 char u = 'U';
 char u_= 'u';
  char v = 'V';
  char v_= 'v';
   char w = 'W';
 char w_= 'w';
 char x = 'X';
 char x_= 'x';
char y = 'Y';
char y_= 'y';
char z = 'Z';
 char z_= 'z';


    if( input == a)
            return b;
    if( input == a_)
            return b_;
    if( input == b)
            return c;
    if( input == b_)
            return c_;
    if( input == c)
            return d;
    if( input == c_)
            return d_;
    if( input == d)
            return e;
    if( input == d_)
            return e_;
    if( input == e)
            return f;
    if( input == e_)
            return f_;
    if( input == f)
            return g;
    if( input == f_)
            return g_;
    if( input == g)
            return h;
    if( input == g_)
            return h_;
    if( input == h)
            return i;
    if( input == h_)
            return i_;
    if( input == i)
            return j;
    if( input == i_)
            return j_;
    if( input == j)
            return k;
         if( input == j_)
            return k_;
    if( input == k)
            return l;
    if( input == k_)
            return l_;
    if( input == l)
            return m;
    if( input == l_)
            return m_;
    if( input == m)
            return n;
    if( input == m_)
            return n_;
    if( input == n)
            return o;
    if( input == n_)
            return o_;
    if( input == o)
            return p;
    if( input == o_)
            return p_;
    if( input == p)
            return q;
    if( input == p_)
            return q_;
    if( input == q)
            return r;
    if( input == q_)
            return r_;
    if( input == r)
            return s;
    if( input == r_)
            return s_;
    if( input == s)
            return t;
    if( input == s_)
            return t_;
    if( input == t)
            return u;
    if( input == t_)
            return u_;
    if( input == u)
            return v;
    if( input == u_)
            return v_;
    if( input == v)
            return w;
            if( input == v_)
            return w_;
    if( input == w)
            return x;
    if( input == w_)
            return x_;
    if( input == x)
            return y;
    if( input == x_)
            return y_;
    if( input == y)
            return z;
    if( input == y_)
            return z_;
    if( input == z)
            return a;
    if( input == z_)
            return a_;
    else
            return input;
  }

   string sentence::rotate( ) {

    b = rotate(b);
    return b;
 }






    string sentence::rotate( string b ) {

  char temp = ' ';
  char d = ' ';
 vector<char> v( b.begin(), b.end() );
 string c = "  ";
 char input = ' ';
 int count = 0;
  int length = b.length();

    while(count <= length ) {
            input = v[count];
            d = rotationOf(input);
            c.insert(count, 1, d);
             d = temp;

                 temp = ' ';
            count++;
    }

   return c;


  }

 string sentence::rotate(int n) {
    //string s; 
    b = rotate(n, b);
    return b;
  }


    string sentence::rotate(int n, string b) {
      int count = 0;
   string f = " ";
    //string a = b; 
   //cout<<b; 

    while( count < n ) {

            f = rotate(b);
            b = f;
            f = " ";
            count++;
    }
    return b;
    }


  bool sentence::operator==( const sentence &other) {
    bool value = true;
    int end = b.length( );
    for( int i = 0; i < end; i++)
    if( b != other.b )
            value = false;

    return value;
      }


      float sentence::scoreWith(class corpus &o ) {

      float score = 0.00;
      string::iterator i;





          int current = 0;

    for( i = b.begin(); i < b.end( ); i++, current++) {
    score = o.proportion(b[current]);
    }
 return score;
 }



      string sentence::decode( class corpus&) { 
    float score = 0.00; 
    string temp; 


    int i = 0; 
    int j = 0; 

    string decoded; 

    float scoreInit = 0.00;
    float highest = 0.00; 

    scoreInit = scoreWith( b); 
    highest = scoreInit; 
    decoded = reverse(b); 

    for(i; i <= 27; i++) { 
            temp = rotate(i, decoded); 
            score = scoreWith(temp); 
            if(score > highest) { 
                    highest = score; 
                    j = i; 
            } 
    }
  return( rotate(j, decoded)); 
 }       

   ostream &operator<< ( ostream &out, const sentence &sentences) { 
    out << sentences.b; 
    out << endl; 
    return out; 
    } 

this is sentence.cpp i know that a lot of it is very inefficient and can be written a lot better but all of the functions work except for scoreWith and possibly decode. scoreWith i need to access the proportion function which is in my corpus.cpp. Our functions are supposed to take in (Corpus&) as a parameter and thats really throwing me off.

/r/learnprogramming Thread