-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdvd.c++
47 lines (40 loc) · 883 Bytes
/
dvd.c++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
using namespace std;
// declare a class
class DVD
{
private:
string brandName;
int capacity;
int retailPrice;
public:
// parameterized constructor to initialize variables
DVD(string x, int y, int z)
{
brandName = x;
capacity = y;
retailPrice = z;
}
void display()
{
cout << "\nBrand Name: " << brandName << endl;
cout << "Capacity: " << capacity << endl;
cout << "Retail Price: " << retailPrice << endl;
}
void changeData(string name, int c, int p)
{
brandName = name;
capacity = c;
retailPrice = p;
}
};
int main()
{
system("cls");
// create object and initialize data members
DVD obj1("The harry porter", 500, 300);
obj1.display();
obj1.changeData("Money Heist", 1000, 400);
obj1.display();
return 0;
}