I have the following code:
#include <iostream>
using namespace std;
class CForward;
void func(CForward* frw) { delete frw; }
class CForward
{
public:
~CForward() { cout << "Forward" << endl; }
};
int main()
{
func(new CForward);
cin.get();
}
I ran the program, and it printed nothing.
Why?
in main, I created new CFoward
, and in func
I deleted it and called it destructor.
It seems that the destructor have not been called. Why? Is that related anyhow to the forward decleration?