Hi all,
I have a problem here that I am not sure how I should go about solving. I am thinking of creating classes that iteratively calls on other classes such that at the end of the day, I can get something like:
Criteria[0].Subcriteria[0].Subcriteria[1].Subcriteria[0].value = a;
So it seems like at first instance, I have a Subcriteria class:
And a Criteria class:
I then declare an array of the Criteria class:
And I supposedly have a list of x subcriterias under this criteria (assuming 1 first), and another set of y subcriterias under each of the x subcriteria and finally z subcriteria under each of the y subcriteria. So theoretically I should have something like the following to specify the upperbound of the subcriteria:
But now it's starting to look cryptic to me and I realise that I am totally lost. So I was wondering if some kind souls can help provide some directions?
Subsequently, I would need to "move up" from the child to the parent class because the value obtained at the lowest child (i.e. Subcriteria[z]) will be aggregated and stored as the value of the parent (i.e. Subcriteria[y]) and this is repeated until Criteria[0] gets a value from all the children.
So, is there a way in which Subcriteria can also check if it's parent is a Subcriteria or a Criteria class? Tentatively, I stored a value of -1 in the Criteria.value variable because I was thinking along the lines of
Head's spinning already.... :(
Cheers,
Angela
I have a problem here that I am not sure how I should go about solving. I am thinking of creating classes that iteratively calls on other classes such that at the end of the day, I can get something like:
Criteria[0].Subcriteria[0].Subcriteria[1].Subcriteria[0].value = a;
So it seems like at first instance, I have a Subcriteria class:
Code:
class Subcriteria {
public:
Subcriteria () {
};
unsigned int value;
};
Code:
class Criteria {
public:
Criteria () {
};
int value = -1;
};
Code:
Criteria *c;
Code:
Criteria[0].Subcriteria[x-1].Subcriteria[y-1].Subcriteria[z-1].value = a;
Subsequently, I would need to "move up" from the child to the parent class because the value obtained at the lowest child (i.e. Subcriteria[z]) will be aggregated and stored as the value of the parent (i.e. Subcriteria[y]) and this is repeated until Criteria[0] gets a value from all the children.
So, is there a way in which Subcriteria can also check if it's parent is a Subcriteria or a Criteria class? Tentatively, I stored a value of -1 in the Criteria.value variable because I was thinking along the lines of
Code:
if (parent.value = -1) {
do some parent-related functions
else {
move up to parent subcriteria and aggregate values
};
Cheers,
Angela
Comment