Stringed Instruments, Inheritance Demo
Instrument.h
1 #include "cmpslib.h"
2 
3 
4 
9 class Instrument
10 {
11 protected:
12 string brand;
13 string model;
14 double cost;
15 double retail_price;
16 string ToMembersXML();
17 
18 public:
20 Instrument(string brand="", string model="", double cost=0, double retail_price=0);
21 
22 string ToString();
23 string ToXML();
24 
25 string GetBrand();
26 string GetModel();
27 double GetCost();
28 double GetRetailPrice();
29 
30 void SetBrand(string);
31 void SetModel(string);
32 void SetCost(double);
33 void SetRetailPrice(double);
34 };
35 
36 
37 
string brand
Brand Name of Product.
Definition: Instrument.h:12
double GetCost()
Accessor function.
Definition: Instrument.cpp:48
Instrument(string brand="", string model="", double cost=0, double retail_price=0)
Definition: Instrument.cpp:17
void SetModel(string)
Mutator function.
Definition: Instrument.cpp:52
double cost
Wholesale Price.
Definition: Instrument.h:14
string model
Model Name of Product.
Definition: Instrument.h:13
string ToString()
Returns a string representation of the entire class.
Definition: Instrument.cpp:26
void SetRetailPrice(double)
Mutator function.
Definition: Instrument.cpp:54
void SetBrand(string)
Mutator function.
Definition: Instrument.cpp:51
string GetBrand()
Accessor function.
Definition: Instrument.cpp:46
double retail_price
Retail Price.
Definition: Instrument.h:15
double GetRetailPrice()
Accessor function.
Definition: Instrument.cpp:49
string ToXML()
Returns an XML string of the entire class.
Definition: Instrument.cpp:37
string ToMembersXML()
Returns an XML string of the data in the class wihout the outer tag with the classname.
Definition: Instrument.cpp:6
void SetCost(double)
Mutator function.
Definition: Instrument.cpp:53
string GetModel()
Accessor function.
Definition: Instrument.cpp:47
Definition: Instrument.h:9