Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

Explain the four trade barriers and why they are important.

Answered: 1 week ago

Question

5.2 Summarize the environment of recruitment.

Answered: 1 week ago