error c2228 from use of object pointer array

I'm currently making a program that would run a video rental store that first reads a file and populates video and customer objects which all runs smoothly however i get an ...4\driver.cpp(101): error C2228: left of '.getID' must have class/struct/union whenever i try to call a function of either video or customer. As an example on Driver.cpp line 95 is where the error is shown to be when i try to call the getID() function from the customer class. Any help would be greatly appreciated.

P.S. The problem is fixed when i use the "->" operator instead of the dot operator but i have never had to use the -> in other programs instead of the dot even when using object pointer arrays and i am wondering if this is a problem in my design or some extraneos error.

Driver.h

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
 #include"video.h"
#include"customer.h"
#include"view.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <cctype>


class Driver
{

public:
	void ProgramStart();
	void loadData();
	void printVideos();
	void printRentedVideos();
	void rentVideo();
	void returnVideo();

private:
	int totalCustomers;
	int totalVideos;
	int index;
	int* rentedVideos[20][21];
	video* videosOwned[20];
	customer* customerList[20];
	view menu;
	bool validateID(int id);

};



Driver.cpp

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
 #include"Driver.h"


using namespace std;

	void Driver::ProgramStart()
	{
		loadData();

	}

	void Driver::loadData()
	{
		char answer;
		cout<< "load data? (if no program about)" <<endl;
		cin>>answer;

		if (toupper(answer)!='Y')
		{
			cout<<"program exit" <<endl;
			system("pause");
			exit(1);
		}

		answer='/n';

		ifstream instream("Programming Assignment 4 Data.txt");

		instream>>totalVideos;

		for(int i=0; i<totalVideos; i++)
		{
			string line[6];
			int coppies=0;
			
			for(int k=0; k<6; k++)
			{
				getline(instream, line[k]);

				if(line[k]=="")
					getline(instream, line[k]);


			}
	
			instream>>coppies;

			videosOwned[i] = new video(line[0], line[1], line[2], line[3], line[4], line[5], coppies);
		}

		while(!instream.eof())
		{
			for(int i=0; i<20; i++)
			{
				string first, last;
				int id;

				instream>>first;
				instream>>last;
				instream>>id;

				if(instream.eof())
					break;

				customerList[i]= new customer(first, last, id);
				totalCustomers++;

			}
		}

			instream.close();

		for(int i=0; i<totalVideos; i++)
		{
			for(int j=0; j<totalCustomers+1; j++)
			{
				rentedVideos[i][j]=new int;
				rentedVideos[i][j]=0;
			}
		}
	}

	void Driver::printVideos(){...}

	void Driver::printRentedVideos(){...}

	void Driver::rentVideo(){...}

	void Driver::returnVideo(){...}

	bool Driver::validateID(int id)
	{
		for(int i=0; i<totalCustomers; i++)
		{
			if(customerList[i].getID()==id)
			{
				index=i;
				return true;
			}
		}
		return false;
	}
Topic archived. No new replies allowed.