CS 1337 Lecture Notes - Lecture 12: Compile Time, Access Modifiers, Name Binding

21 views5 pages

Document Summary

// description : hello world in c++, ansi-style. * concept and we don"t expect anybody to. * we instead expect people to inherit and extend. * sometimes there is a method in this class. * that i want all child classes to provide class shape { //base class, parent class private: public: class. //means all direct subclasses must provide a getname. //because shape has a pure virtual function, that makes shape an abstract virtual string getname() = 0; virtual ~shape () { const string name = shape; //return name; virtual ~rectangle() { width = length = 0; width = 1; length = 1; return width * length; return rectangle; double width; double length; * if your class has any virtual methods or. * if any of your parent classes have any virtual methods. Rectangle() { void setwidth(double w) { void setlength(double l) { double getarea() const { virtual string getname() const {

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