#include<iostream.h>
	 #include<conio.h>
	 class test
	 {
	  public:
		int data1;
		char data2;
		test()
		{
			cout<<"contrsuctor";
			data1=1;
			data2='a';
			}
		~test()
		{
			cout<<"destrucor";

			}
		void show()
		{
		cout<<"data1"<<data1;
		cout<<"data2"<<data2;

		}
		};
	 void main()
	 {
		test *ptr;
		test object1;
		ptr = &object1;
		cout<<"\npointer\n";
		ptr->show();
		delete ptr;
		getch();
		}

What is your question?

Firstly, what is the purpose of this program, secondly, I don't think it's very good style to do the actual methods inside the header file itself, and also int data1 and char data2 should be private members. It should look kinda like this:

class Test
{
 private:
   int data1;
   char data2;

 public:
   Test();
   ~Test();
   void show();
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.