#include <iostream>
#include"header.h"
int main() {
t::inc();
std::cout << t::i << std::endl; // -> output is: 1
t::print_i(); // -> output is : 1
}
#ifndef UNTITLED1_TEST_H
#define UNTITLED1_TEST_H
namespace t {
extern int i;//note the keyword extern and no initializer here
void inc() ;
void print_i() ;
}
#endif
#include "header.h"
#include<iostream>
int t::i{}; //initialize t::i
void t::inc() {
t::i++;
}
void t::print_i() {
std::cout << t::i << std::endl;
}