#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstdint>
class data
{
public:
data() { std::cout << "data init~\n"; }
~data() { std::cout << "data exit~\n"; }
};
class number
{
public:
number() { std::cout << "number init~\n"; }
~number() { std::cout << "number exit~\n"; }
};
class Base
{
public:
Base() { std::cout << "Base init\n"; };
virtual ~Base() { std::cout << "Base exit~\n"; };
private:
data inter;
};
class worker : public Base
{
public:
worker() {
std::cout << "Worker init\n";
}
~worker() {
std::cout << "Worker exit\n";
}
private:
number nm;
};
int main()
{
{
worker aa;
}
return 0;
}
结果:
image.png
网友评论