calling function from class

Im trying to call a bool function called birth(int x, int d, int &v) in main. the function is in a class called GridWorld. Im havin trouble calling it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

int main(){
	
	int row,col;
	
	cout<<"Enter grid size"<<endl;
	
	int dist_row,dist_col;
	
	int a =0;
	
	cin>> row>>col;
	
	GridWorld(row,col);

	cout<<"Enter District"<<endl;
	
	cin>>dist_row>>dist_col;


	
	GridWorld firstWorld;
	firstWorld.birth(dist_row, dist_col,a);	
closed account (SECMoG1T)
not much info is available from your code, what errors are you getting , can you post some code that can reproduce the error.

well line 14 does nothing, you should instantiate an object of type GridWorld the way you've done it on line 22.
Last edited on
Topic archived. No new replies allowed.