Link to home
Start Free TrialLog in
Avatar of panJames
panJames

asked on

C++, array of pointers to objects

Hello experts, please have a look at the code below:

#include <iostream>
using namespace std;

class Dog{
public:
	int x;

};

int main(){
	Dog * matrix[12];
	int * matrixInt[12];

	*matrixInt[0] = 12; //works fine
	*matrix[0]->x = 12; //does not work

	return 0;
}

Open in new window


How can I make it work?
Thank you

panJames
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial