help in aggregation implementation
I have a problem in implementation of aggregation in my project....I tell you the whole situation........
I have three classes as ShowImage ,ShowGraphic ,ShowNewGraphic........
ShowImage is aggregation of ShowGraphic and ShowGraphic is aggregation of ShowNewGraphic........
I have a string which is created in ShowGraphic class createPath() function and it has to set
in setResource(Char*) function of ShowNewGraphic class.
The condition is that we have to create object of ShowGraphic in createPath() function since it
returns the object of ShowGraphic
So this is the current situation.........
What I have done is that I have used constructor's for passing the string.......
I write following code in ShowImage class createPath() function:
And in constructor of ShowGraphic I have wrote following code:
char *str= "/usr/local/filename";
ShowGraphic showgraphic =new ShowGraphic(str);
And in ShowNewGraphic class constructor I have called setResource(Char*) function and set it value:
ShowGraphic::ShowGraphic(char* path) : ShowNewGraphic(path)
Let me know that it is a correct implementation or I have to change it .........