+ 1
I need to add nomber that user defined it of opject to the class l mean the construct function in the firsr
if l have a class "student"contains some attribute such as name and other isesintal thing and l need to add an ...x...object(s) the ....x .... is a nombre of this opject that users can defined it what is the strategy that l should follow it . l use the cpp language
3 Réponses
+ 4
class student
{
public:
int x;
/*
some other code
*/
};
int main()
{
student s;
cin>>s.x;
}
/*i think this the solution you want
*/
+ 4
just make it into an array
0
the ..x.. is number of object in other words the x is nomber of (s1.s2.s3.....)
that mean the user who say how many ....s.... are there by give the x value for examble x=3
we have three object (s1.s2.s3)