CSE 250 Lecture Notes - Lecture 13: Semicolon, Special Functions, Disk Array

45 views4 pages

Document Summary

Our class has the following layout: template class cse vector { public: T& at(int index); int size() const; bool empty() const; void resize(int newsize); void insert(int index, const t& value); void push_back(const t& vlue); void erase(int index); Differences from java: we do(cid:374)"t ha(cid:448)e to (cid:374)a(cid:373)e the file the sa(cid:373)e as the (cid:272)lass, at the end of the class definition, you put a semicolon, you do(cid:374)"t spe(cid:272)if(cid:455) ea(cid:272)h i(cid:374)di(cid:448)idual fu(cid:374)(cid:272)tio(cid:374) as pri(cid:448)ate or pu(cid:271)li(cid:272) You can define things within the class, but if you would actually want to depends on the size of the function. Functions are usually declared in class, but defined outside of class. Included code adds to size of executable: can define class in . hpp and then define methods in separate . cpp files. Exception for templated types: may cause compiler issues separating code, so we will keep templated class in same file: we declare a function in the class as: rett(cid:455)pe fu(cid:374)(cid:272)tio(cid:374)(cid:894) (cid:895);

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