Pointer to pointer to class

Compiler is telling me the address pointed to by pTRI is invalid with the use of -> directive.
1
2
3
4
5
6
7
8
9
10
11
12
int main(){
	ctriangle* TRI=ctriangle::GetNewTri();
	crectangle* REC=crectangle::GetNewRec();
	csquare* SQU=csquare::GetNewSqu();
	while(true){
		printf("Enter 'help' for list of commands\n");
		cout << TRI << endl << REC << endl << SQU << endl;
		string strinput=getinput(DEFAULTMSG);
		ParseInput(strinput,&TRI,&REC,&SQU);
	}
	return 0;
}

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
void ParseInput(std::string strinput,ctriangle** pTRI,crectangle** pREC,csquare** pSQU){
	cout << *pTRI << endl << *pREC << endl << *pSQU << endl;
	const string help("help");
	const string printshapes("print shapes");
	const string clearentries("clear entries");
	if(strinput.compare(help)==0){
		PrintHelpStatement();
		return;
	}
	if(strinput.compare(printshapes)==0){
		*pTRI->PrintAll();
		*pREC->PrintAll();
		*pSQU->PrintAll();
		return;
	}
	if(strinput.compare(clearentries)==0){
		*pTRI=NULL;
		*pREC=NULL;
		*pSQU=NULL;
		printf("entries cleared\n");
		return;
	}
	printf("Error. Invalid string entry by user\n");
	return;
}


The first line in the ParseInput fx is part of my previous troubleshooting before resorting to the forums, along with the cout statement in main. When I run the program(after commenting out the strinput.compare(printshapes) control path, the part giving me the errors, of course), the cout statement in main prints the same addresses as the cout statement in ParseInput().

In the event that it turns out to be relevant, the GetNewTri/Rec/Squ functions are defined as public static member functions of their classes, and look like.
1
2
3
static ctriangle* ctriangle::GetNewTri(){
        return new ctriangle;
}


Any ideas? Thanks guys.
Last edited on
to_top("pointer_to_pointer_to_class/thread");
Topic archived. No new replies allowed.