I am not sure how to have a function that receives a class object as a parameter. Any help? Here is an example below.
#include
void function(cla
At its simplest:
#include
using namespace std;
class A {
public:
A( int x ) : n( x ){}
void print() { cout << n << endl; }
private:
int n;
};
void func( A p ) {
p.print();
}
int main () {
A a;
func ( a );
}
Of course, you should probably be using references to pass the object, but I suspect you haven't got to them yet.