Hey.
I have to implement some FractalDrawer project using inheritance and std::vector. I have described the details of the exercise here:
Fractal Drawer Project - STL and OOP - C++
Each fractal consists of a single white-space or #'s.
For example, we have Sierpinsky Carpet fractal whose "base" (n=1) form (3X3 grid; BTW, the other fractals are also squares) is:
So I need an abstract class of Fractal which has to hold vector of Fractal object too, as each cell of the grid is actually the same fractal grid but of a lower order (n-1).
So, in this example, if I would like to print a Sierpinsky Carpet fractal of order 2, then each of its base form's cells is actually the grid of the same fractal of order 1! Thus:
Code:
#########
# ## ## #
#########
### ###
# # # #
### ###
#########
# ## ## #
#########
But, I'm really really struggling to write some actual code, I don't know if anything of my declarations is legal, if really needed.
For example, I'm not sure it's correct at all to declare inside the abstract class of Fractal a std::vector<Fractal> which holds the same data type which is now declared.
Don't know which constructor do I have to declare... How the print function has to be performed.
I'm really bad at OOP, as always.
Can someone maybe guide me/help me somehow with that?
Thanks in advance.