inheritance & pointers


Write a program that will define the following two classes
Class Student
- Name : string
- Age: int
+ setName(string) : void
+ setAge(string): void
+ getName(): string
+ getAge(): int
+ Student (int=0, string=””)

Class Course
Private members:
1. Course Title
2. Course Teacher
3. Max size of Student number
4. count the enroll student
5. a pointer of class Student
Some hints for the public members:
1. The constructor will create a dynamic array of maxSize size and the count will equal 0 (if the maxSize is negative then it
Set the maxSize to 10
Course
- Title : string
- Teacher: string
- MaxSize: int
- count: int
- StuList: Student *
+ setTeacher(string) : void
+ setTitle(string): void
+ getTeacher(): string
+ getTitle(): string
+ insertStudent(Student): bool
+ Course (string, string, int =10)
+ Course(Course&):copy constr
+ ~Course
+ print( ): void

2. insertStudent function: if the count less than the MaxSize it will add a new student object to the StuList and increment the count then return true. Otherwise it will return false.
3. Copy Constructor: to avoid shallow copy
4. Destructor for deleting the dynamic array
5. Print( ): to print the course information (every thing)





In the main we can ask to do the following
• declare a course object C1
• set the values of C1 by using set Functions
• declare a course object C2 by using copy constructor
• Make some changes to C2
• Let the user add as much students as he want to C1 or C2
• print C1 and C2




We need 5 files with full comments










Okay... what is your question? What have you coded so far? Make sure to use code tags when you reply with code so it will be easier for us to give help.
what's the code of this program??!
In fact the code is fully descripted in your assignment. For example let consider the description of member functiion setName of class Student

+ setName(string) : void

The only thing you shall do is to add a statement tto the function body that assigns data member Name to the function parameter.
Topic archived. No new replies allowed.