Question: I am learning C++ and I am not clear about the destructor of a class. For example:

```
class A:
{
  public:
    int valueA;
  private:
    int valueB;
};

A:~A()
{
  delete valueA;
  delete valueB;
}

```

So, basically is it right to delete every declarations in the public and private?

Answer: 
No, you only need to `delete` that which has been allocated using `new`. Simple value types like `int`s never need to be deleted.

If your class *did* include data dynamically allocated using `new` either by the constructor or later by some other method then the destructor should typically de-allocate all of it, regardless of wether the data is public or private.

I might add that having publically visible dynamically allocated pointer members might not be the best design, though.
No，just delete some pointers that are constructed in your class.