[try Beta version]
Not logged in

 
calling function from class

Oct 2, 2018 at 3:05am
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);	
Oct 2, 2018 at 5:50am
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 Oct 2, 2018 at 5:50am
Topic archived. No new replies allowed.