CPSC 1100 Lecture 8: CPSC 1100 Lecture 8

14 views2 pages
8 Feb 2017
School
Course
Professor

For unlimited access to Class Notes, a Class+ subscription is required.

9/27
Constructor name always same as class name
Compiler can tell apart because they take different arguments
A constructor that takes no arguments is called a no argument constructor
Statements in the constructor body will set the instance variable of the object
Objectname.method
Start a comment with /**
Describe method’s purpose
Describe each parameter
Start with @param
Name of parameter that holds argument
Short Explain of argument
Describe return value
Start with @return
Describe return value
Omit @param tag for methods that have no argument
Omit @return tag for methods whose return type is void
End with */
Documenting a class
Place above class declaration
Supply a brief comment explaining purpose of class
Constructor’s job is to initialize the instance variables of the object
To test a class either
Use an environment for interactive testing
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$10 USD/m
Billed $120 USD annually
Homework Help
Class Notes
Textbook Notes
40 Verified Answers
Study Guides
1 Booster Class
Class+
$8 USD/m
Billed $96 USD annually
Homework Help
Class Notes
Textbook Notes
30 Verified Answers
Study Guides
1 Booster Class