Definition file and class test
This commit is contained in:
2
main.cpp
2
main.cpp
@@ -9,6 +9,8 @@ int main() {
|
||||
cout << c << "\n";
|
||||
}
|
||||
|
||||
Test t1(55);
|
||||
t1.print();
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
15
test.cpp
Normal file
15
test.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user