CMPSC 16 Lecture Notes - Lecture 8: Morphism Of Algebraic Varieties, Return Statement, Type Conversion

28 views3 pages
21 Oct 2016
School
Course
Professor

Document Summary

C++ allows more than one definition for the same function name: co(cid:374)(cid:448)e(cid:374)ie(cid:374)t for situatio(cid:374)s i(cid:374) (cid:449)hi(cid:272)h the (cid:862)sa(cid:373)e(cid:863) fu(cid:374)(cid:272)tio(cid:374) is (cid:374)eeded for different numbers of types of arguments. Overloading function name: providing more than one declaration and definition using the same function name. Compiler checks the number and types of arguments in the function call decides which function to use. Overloaded functions must: have different numbers or formal parameters, and/or. Have at least one different type of parameter. Return a value of the same type. C++ will automatically convert types between int and double in multiple examples ie. diving integer by double results in double. C++ does the same with overloaded functions. The compiler chooses the function that matches parameter types. *do not use the same function name for unrelated purposes! void functions. In a top-down design, (cid:449)e"ll (cid:449)a(cid:374)t to desig(cid:374) su(cid:271)tasks, ofte(cid:374) i(cid:373)ple(cid:373)e(cid:374)ted as fu(cid:374)(cid:272)tio(cid:374)s.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents