Extend class Vect (definition shown above) by defining accessor functions getR and getTheta, which return the values of the private components of a Vect object.
What will be an ideal response?
```
class Vect {
public:
Vect() {}
Vect( double, double );
double getR() const;
double getTheta() const;
private:
double r; // magnitude
double theta; // direction (radians)
};
//
// Constructor 2: Initializes all components
//
Vect :: Vect( double vectMag, double vectDir )
{
r = vectMag;
theta = vectDir;
}
//
// Accessor for private component r
//
double Vect::getR() const
{
return r;
}
//
// Accessor for private component theta
//
double Vect::getTheta() const
{
return theta;
}
```
You might also like to view...
What are the steps taken in the cash disbursement system?
What will be an ideal response?
Active white spaces in a wireframe help a user to focus on one part of the page.?
Answer the following statement true (T) or false (F)