CSC112 Spring 2016 Examples
1#include <iostream> 2#include "ns1.h" 3 4namespace ns1 5{ 6 void f() 7 { 8 std::cout << "ns1 function f" << std::endl; 9 } 10 11 12 Example::Example() 13 { 14 //we have not called f yet! 15 count = 0; 16 } 17 18 void Example::f() 19 { 20 //count calls to f 21 std::cout << "Called: " << count++ << " times." << std::endl; 22 } 23} 24