CSE 278 Lecture Notes - Lecture 4: Data Type, Init, Floating Point

17 views1 pages

Document Summary

Cse 278 - lecture 4 - basics of c++ language. Integer types: byte, char, short, int, long, bool. Const is used for variables that are not going to change. Const parameter: a reference parameter cannot be modified. Constant methods have const at the end of their declaration. It is a contract implying that the method does not modify data encapsulated by the object. Make sure that method is getter not setter. This is not exactly the same thing as final in java, which can also imply that classes cannot be extended. In c++ there are mechanisms to provide an alias not only to the variables but also the type. This provides some flexibility but at some expense. The default arithmetic operators are as in java, with the same precedence rules. In general for c-strings and strings, it is not possible to use + for concatenation, but the operator can be overloaded.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents