except that there is no need to work with pointers and dynamic allocation.
And student::create_student or subject::create_code() don't create new instances, but set the state of the object
you guys might be confusing him, I think for a beginner he is trying to use the dot operator.
any basics to call your functions or objects:
WRITE CLASS NAME CLASS OBJECT-CREATED NAME;
1 2 3 4 5 6 7 8 9 10 11 12 13
int main()
{
subject myobject;
//to access members of the class
//write myobject then .(dot) call what ever is inside your class
//its would be the same as usual for any public objects only
//just remember your object name and the dot operator
myobject. create_code();
return 0;
}
on modified code above, you will have data packed in an array , look to
student yourstudent[counter];
how many your students are depending to your input assigned to counter.
its like
1 2 3
yourstudent[1]
yourstudent[2]
yourstudent[etc]
my second sample above answer your problem, after creating subject it shows the list, and if you like to see specific student you can use