passing objects to functions in C++

Consider the following code in order to pass class objects as arguments to functions.

#include<iostream>

class firstClass
{
      public:
      int AfirstClass;
};

class secondClass
{
      public:
      int BsecondClass;
      // getting passed objects
      void function(firstClass copiedObject)
      {
           std::cout<<copiedObject.AfirstClass;
      }
};

int main()
{
    firstClass a;
    a.AfirstClass = 200;

    secondClass b;
    b.BsecondClass = 100;
    
    // passing class objects to functions 
    b.function(a);
    
    getchar();
    return 0;
}