I am using the two .h files and the two .cpp file.
The employee.h file contains
class Employee
{
        public:
          std::string Name,Id,Address;
};
The second .h file stack.h contains
 #include "employee.h"
class Stack
{
  public:
   int total=0;
    void push();
    void pop();
    void display();
};
The first.cpp file stack.cpp contains
#include "stack.h"
Employee obj1;
Stack emp[10];
void Stack::push()
{
  if(total>=10)
  {
    total--;
    std::cout <<"Stack is Overflowed";
  }
  else
  {
   std::cout<<"Enter data of employee "<<std::endl;
    std::cout<<"Enter employee name: ";
   std::cin>>emp[total].obj1.Name;
    std::cout<<"Enter id: ";
    std::cin>>emp[total].obj1.Id;
    std::cout<<"Enter address: ";
    std::cin>>emp[total].obj1.Address;
  }
  total++;
}
The second cpp file main.cpp contains
#include "stack.h"
Stack obj;
int main()
{
  obj.push();
}
While i am executing above files it is giving an error like this
g++ stack.cpp main.cpp
stack.cpp: In member function ‘void Stack::push()’:
stack.cpp:16:25: error: ‘class Stack’ has no member named ‘obj1’
    std::cin>>emp[total].obj1.Name;
                         ^~~~
stack.cpp:18:26: error: ‘class Stack’ has no member named ‘obj1’
     std::cin>>emp[total].obj1.Id;
                          ^~~~
stack.cpp:20:26: error: ‘class Stack’ has no member named ‘obj1’
     std::cin>>emp[total].obj1.Address;
If i remove the obj1 from stack.cpp then it will giving an error like this code:
std::cout<<"Enter data of employee "<<std::endl;
    std::cout<<"Enter employee name: ";
   std::cin>>emp[total].Name;
    std::cout<<"Enter id: ";
    std::cin>>emp[total].Id;
    std::cout<<"Enter address: ";
    std::cin>>emp[total].Address;
Error:
g++ stack.cpp main.cpp
stack.cpp: In member function ‘void Stack::push()’:
stack.cpp:16:25: error: ‘class Stack’ has no member named ‘Name’
    std::cin>>emp[total].Name;
                         ^~~~
stack.cpp:18:26: error: ‘class Stack’ has no member named ‘Id’
     std::cin>>emp[total].Id;
                          ^~
stack.cpp:20:26: error: ‘class Stack’ has no member named ‘Address’
     std::cin>>emp[total].Address;
Can anyone please help to this problem?
 
     
    