ex4-7.cpp - Example 4-7 When is a constructor called? (2)

// File: ex4-7.cpp

#include <iostream>
using namespace std;

class Z
{
  public:
	 Z(void)
	 {
	  cout << "Z's constructor is called now" << endl;
	 }
	 ~Z()
	 {
		cout << "Z's destructor is called now" << endl;
	 }
};

Z funk1(Z hey)
{
  cout << "This is funk1\n";
  return hey;
}

int main(void)
{
  Z temp;
  funk1(temp);
  return 0;
}



CIS27: Programming in C++    Instructor: Joe Bentley