c++ delete pointer issue
I don't really understand why are those pointer accessible ... any help appreciated

wewefwefwefwefwefw ef wef wef wef wef wef wefwe fwef wef wef wef wef wef wef wef we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f



    #include <iostream>

    class Wicked{
    public:
	Wicked() {};
	virtual ~Wicked() {};

	int a;
	int b;
    };


     class Test
     {
    public:
	Test() {};
	virtual ~Test() {};

	int c;

	Wicked * TestFunc()
	{
		Wicked * z;
		c = 9;
		z = new Wicked;
		z->a = 1;
		z->b = 5;
		return z;	
	};	
    };

    int main()
    {
	Wicked *z;
	
	Test *t = new Test();
	z = t->TestFunc();

	delete z;
	delete t;
	
	// why can I set 'z' when pointer is already destroyed?
	z->a = 10;
	
	// why does z->a print 10?
	std::cout << z->a << std::endl;

	// why does t->c exist and print correct value?
	std::cout << t->c << std::endl;


	//------------------------------------------------------
	
	int * p = new int;
	*p = 4;

	// this prints '4' as expected
	std::cout << *p << std::endl;

	delete p;

	// this prints memory address as expected
	std::cout << *p << std::endl;

 	return 0;
    }
c++ delete pointer issue
===

I don't really understand why are those pointer accessible ... any help appreciated

wewefwefwefwefwefw ef wef wef wef wef wef wefwe fwef wef wef wef wef wef wef wef we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f we f



    #include <iostream>

    class Wicked{
    public:
	Wicked() {};
	virtual ~Wicked() {};

	int a;
	int b;
    };


     class Test
     {
    public:
	Test() {};
	virtual ~Test() {};

	int c;

	Wicked * TestFunc()
	{
		Wicked * z;
		c = 9;
		z = new Wicked;
		z->a = 1;
		z->b = 5;
		return z;	
	};	
    };

    int main()
    {
	Wicked *z;
	
	Test *t = new Test();
	z = t->TestFunc();

	delete z;
	delete t;
	
	// why can I set 'z' when pointer is already destroyed?
	z->a = 10;
	
	// why does z->a print 10?
	std::cout << z->a << std::endl;

	// why does t->c exist and print correct value?
	std::cout << t->c << std::endl;


	//------------------------------------------------------
	
	int * p = new int;
	*p = 4;

	// this prints '4' as expected
	std::cout << *p << std::endl;

	delete p;

	// this prints memory address as expected
	std::cout << *p << std::endl;

 	return 0;
    }