Question: C + + Proxy objects > Modify Proxy.h and Proxy.cpp to add proxy objects 1 . Due to the improved optimization ability of the compiler

C++ Proxy objects>
Modify Proxy.h and Proxy.cpp to add proxy objects
1. Due to the improved optimization ability of the compiler(Some restrictions apply...)
2. You cannot implement the following function in the header, you should be implementing the appropriate proxy with 5 vectors.
Vect2D operator +(const Vect2D &tmp) const;
3. Data needs to stay private. You cannot make it public
4. You _CAN_ do work in the header for your proxies
//1. Proxy.h
#ifndef PROXY_H
#define PROXY_H
// Modify This File
class Vect2D
{
public:
Vect2D(const Vect2D &tmp)= default;
Vect2D &operator =( const Vect2D &tmp)= default;
Vect2D()= default;
~Vect2D()= default;
Vect2D(const float inX, const float inY);
void setX(const float inX);
void setY(const float inY);
void set(const float inX, const float inY);
float getX() const;
float getY() const;
//-----------------------------------------------
// Rules : this function cannot be inlined or implemented directly
// Vect2D operator +(const Vect2D &tmp) const; //<- cannot be inlined or implemented directly
//-----------------------------------------------
private:
float x;
float y;
// Add friends here...
friend class ProxyVect2D;
};
#endif
//--- End of File ---------------
//2. Proxy.cpp
#include "Proxy.h"
// Modify This File
//--- End of File ---------------
//3. Proxy_Readonly.cpp
//!!! DO NOT MODIFY THIS FILE !!!
#include "Proxy.h"
Vect2D::Vect2D(const float inX, const float inY)
: x(inX), y(inY)
{
}
float Vect2D::getX() const
{
return this->x;
};
float Vect2D::getY() const
{
return this->y;
};
void Vect2D::setX(const float inX)
{
this->x = inX;
};
void Vect2D::setY(const float inY)
{
this->y = inY;
};
void Vect2D::set(const float inX, const float inY)
{
this->x = inX;
this->y = inY;
};
//--- End of File ---------------
Please Modify Proxy.h, Proxy.cpp.
***Please check annotaion comments carefully.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!