Definition file and class test

This commit is contained in:
2023-07-27 12:17:43 -07:00
parent dd3bac8814
commit 5de4e93ec8
2 changed files with 17 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ int main() {
cout << c << "\n";
}
Test t1(55);
t1.print();
return 0;

15
test.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include <iostream>
#include "test.h"
Test::Test(int a) {
this->a = a;
creation_count++;
}
Test::~Test() {
creation_count--;
}
void Test::print() const {
std::cout << "The objects value is: " << a << "\n";
std::cout << "There have been " << creation_count << " objects created" << std::endl;
}