Hints for COMP104 Lab 11 - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Hints for COMP104 Lab 11

Description:

Hints for COMP104 Lab 11. What Should You Submit? 3 files to submit. lab11.h ... Implementation of movie player using class. User-defined constructor ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 11
Provided by: cpeg
Category:
Tags: comp104 | hints | lab

less

Transcript and Presenter's Notes

Title: Hints for COMP104 Lab 11


1
Hints for COMP104 Lab 11
2
What Should You Submit?
  • 3 files to submit
  • lab11.h
  • Definition of struct Node
  • Definition of class player
  • lab11.cpp
  • implementation of member functions in class
    player
  • main.cpp
  • main() function
  • Given on the lab page. No modification is allowed!

3
Requirements
  • Implementation of movie player using class
  • User-defined constructor
  • Frames in doubly linked list
  • Private data members (e.g. Head, cur)
  • NO pointers as parameters for member functions
  • NO global variables except constants
  • NO memory leakage

4
What should you do?
  • The program will have the same functionalities as
    the one in Lab 10
  • You dont have to write all the codes yourself
  • Modify the version from Lab 10
  • But you have to understand the similarities and
    differences between Labs 10 and 11
  • Which portions are you going to modify?

5
What should you do?
  • Similarities in Labs 10 and 11
  • Functions to perform each sub-task
  • States/components of player (e.g. List of frames)
    have to be kept
  • Differences between Labs 10 and 11
  • Functions in Lab 10 are defined globally
  • Everyone could use the functions anywhere for any
    number of times
  • Functions in Lab 11 are defined in class player
  • Only a subset of functions are visible globally
    (i.e. public functions)
  • Remaining functions are private
  • States of player in Lab 10 is kept by function
    main() and start_104player()
  • States of player in Lab 11 is kept by the class
    player

6
What should you do?
  • Understand the program structure of Lab 10
  • Whats the logic flow of main()?
  • Whats the purpose of each function?
  • How are they related?

7
Modifications from Lab 10
  • Functions are defined in class player
  • Most of them are found in lab 10
  • Which of them should be public?
  • Which of them should be private?
  • Need some changes as NO pointer parameters could
    be used
  • Need some new ones
  • Constructor (more explanation in later slides)
  • Any more?
  • Put the implementations in lab11.cpp
  • Put the prototypes (inside the class) in lab11.h

8
Modifications from Lab 10
  • State/components of player are kept by the class
    player
  • Most of them are found in main() and
    start_104player() of Lab 10
  • E.g. Head pointer to the doubly linked list
  • Any more?
  • Remember You cant use pointers as function
    parameters in Lab 11
  • How to access those parameters?
  • They have to be kept by the class player (as data
    members)
  • Put the declarations (inside the class) in lab11.h

9
Modifications from Lab 10
  • Constructor of class player
  • Initialize data members in class player
  • Parameters are required
  • Try to examine main.cpp to guess what it is

10
Final Notes
  • Normal functions and classs member functions are
    different
  • How to separate them in the code?
  • will always before the names of
    member functions
  • E.g. void playerstart()
  • Constructors have NO return types (not even void)!
Write a Comment
User Comments (0)
About PowerShow.com