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