I was just trying to implement one of the design pattern Strategy of the gang of four .
In my application one of my strategies has to operate on the data (and the data is huge , not 1 not 2 but huge) , now as the GoF says that you can pass the data to the strategy by just a function call , but in my case data is huge , the other way round is to send the context itself to strategy but agaib in this case I have to provide getter functions in the Context.
Now my thinking is that can we make Strategy friend in the context so whenever they have to operate on the data they can easily do so , here we don't need to pass and data nor we need to provide any getter functions.
Does the friend solution violate the intent of the Strategy Pattern

I don't think violates anything, but why don't you pass the data by reference so that it isn't a problem anymore?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.