Here's your approach using inheritance:
1. Define a
Vector3D base class with protected x, y, z members and a constructor.
2. Define a
ForceVector class that inherits from Vector3D and adds an add() method.
3. Read n, then create a result ForceVector initialized to (0,0,0).
4. Loop n times: read a force vector and add it to result.
5. Check if result equals (0,0,0).
6. Output YES or NO based on the check. The inheritance structure keeps your code organized and extensible.