So I am calling a function which takes input as limit i, and array of objects h.
#include<iostream>
#include<vector>
using namespace std;
class hotel
{
private:
    string name,add;
    char grade;
    int charge,no;
public:
    void getdata();
    void putdata();
    void grade_print(int,hotel[]);
    void room_charge();
    void top2();
};
void hotel::getdata()
{
    cout<<"Add Name: ";
    getline(cin>>ws,name);
    cout<<"Add Addres: ";
    getline(cin>>ws,add);
    cout<<"Enter grade,room charge and no. of rooms: ";
    cin>>grade>>charge>>no;
}
void hotel::putdata()
{
    cout<<name<<endl<<add<<endl<<grade<<endl<<charge<<endl<<no;
}
void hotel::grade_print(int num,hotel h[])
{
    int i,j,k; char val;
    for(i=0;i<num;i++)
    {
        val=h[i].grade;
        for(j=0;j<num;j++)
        {
            if(h[j].grade==val)
            {
                cout<<h[j].grade<<endl;
                h[j].grade=' ';
            }
        }
    }
}
int main()
{
    std::vector <hotel> h(1);
    int i=0,j;
    cout<<"Want to add hotel? Press 1: ";
    cin>>j;
    while(j==1)
    {
        h[i].getdata();
        h.resize(2);
        i++;
        cout<<"Want to add more? Press 1 for yes, 0 for no: ";
        cin>>j;
    }
    grade_print(i,h);
}
error here is showing that the grade_print is out of scope. Also the grade is a private member but is called by member function. So why is it showing that grade can't be called. Please tell me why so and what can I do to fix it? Edit1: Declaring function as static void is not helping as the compiler is showing function can't be declared as static void.
D:\C++ Programs\testfile.cpp|30|error: cannot declare member function 'static void hotel::grade_print(int, hotel*)' to have static linkage [-fpermissive]|
 
    