/* 
* Code Snippets for this week
* Small programs to show bits of C and bits of C. 
* >> I've tried to put * at the start of all the comment lines.
* >> I wrote this without a compiler, so might need tweaks.  
*/

/*
* Example Inheritance example - interface file (student.h) 
*/
#ifndef _EXAMPLE_H_
#define _EXAMPLE_H_

/* Need to see the Person interface file */
#include "Person.h"

/* : = extends */
class Student : public Person
{
private:
    static const int NAME_MAX = 32;
    char name[NAME_MAX];
    int mark;
public:
    Student();
    Student(char* name, int mark); 
   ~Student();
  
    void setMark(int m);
    int getMark();

    /* get/set name has moved to the base class */

    void printStudent(Student s);
    void fillStudent(Student *s);
}; 

/* 
* calling through to the parent constructor 
* given Person has a constructor which looks like
* Person(char* name);
*/

Student::Student(char* studentName, int mark) : Person(studentName)
{
    /* etc. */

/* 
* Calling base method from override in derived class 
*/


/* 
* Upcast
* - this is implicity
*/
Person *p;
Student *s = new Student("John",25);

p = s;

/* 
* Downcast
*/
Student *s;
Person *p = new Student("Bob",20);

s = static_cast<Student*>(p);

/* if this can't be checked at compile time we'd need 
* a dynamic_cast
*/


