Hello everyone,
I have two classes Student and Courses. Class Students creates an object of class Courses since each Student will take some Courses.
How can I call an object of class Courses in class Students such that each Student class will have an instance of class Courses which will take care of setting , getting and printing course details for each students.
Also, how can I use inputs from console to initialize Students created. i.e., prompt user for input and use the set methods of the objects to take the console inputs to initialize the Student created.
I really dont understand the need of creating a class within another class..
The logic there seems to be pretty cluttered.
Instead, there should be 2 separate classes which make things simple for further modifications.
Also, delegations are a better way of object orientated programming.
The student class can be aware of the courses class where as the course is completely unaware of the existance of a student class.. I think printing details would also be easier in this case..
Hello everyone,
I have two classes Student and Courses. Class Students creates an object of class Courses since each Student will take some Courses.
How can I call an object of class Courses in class Students such that each Student class will have an instance of class Courses which will take care of setting , getting and printing course details for each students.
Also, how can I use inputs from console to initialize Students created. i.e., prompt user for input and use the set methods of the objects to take the console inputs to initialize the Student created.
He doesn't seem to grok the concept of having members in a class that aren't primitives, he's not looking at nested or inner classes at all (though his topic does suggest so).
Yet any basic tutorial (and certainly his teacher) will handle that in the first few lessons...
It's therefore obvious that he needs to pay more attention in class, or he'd not have needed to ask this question, as it will have been handled already (and his course material will also handle it, if he but reads it).
I'll give him the simple answer to the first part simply because he typed his question like an adult and not some kid using a bunch of net lingo shortcuts.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.