Quantcast
Viewing all articles
Browse latest Browse all 8542

C++ Pointers and References when picking objects

@Petras_Vestartas wrote:

Hi,

I have dummy question for references and pointers in C++ Rhino picking objects.
It is more lack of knowledge of language.

In the example below and object is picked from rhino.
In one case the object is declared as reference in other as a pointer.
Can variables (obj_ref and obj) be declared both as pointers or both as references?
What would be core difference in programming between pointers and references, for me it is very similar concept just references cannot be changed.

	CRhinoGetObject go;
	go.SetCommandPrompt(L"Select object");
	CRhinoGet::result res = go.GetObjects(1,1);

	if (res == CRhinoGet::object) {
		const CRhinoObjRef& obj_ref = go.Object(0);//reference
		const CRhinoObject* obj = obj_ref.Object();//pointer

		if (obj) {
			//...
		}
	}

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8542

Trending Articles