I find myself stumnped by what should be a simple problem. How do you make a class (created in a seperate file) have global scope when using forms in Microsoft C++. I can declare, initalize, and use it in a textbox leave or keypress function but when I move to a button it is out of scope (the button and textbox have global scope, but I just am stumped by how they do it). The problem is to make a clone of the class (object) and to do that it is advantageous to have the global scope. I realize this is homework, and I am not asking for code, just point me in the right direction. Thanks DJ
using namespace Circle;
form1 code textBox1->Keypress(...) {
Circle^ C = gcnew Circle(Convert.ToDouble(textBox1->Text)); // write to labels on form the rad, area, and circum
}
button1->click(...) { // I want to make a clone of the instance above
Circle^ C = gcnew Circle(Convert.ToDouble(textBox1->Text));
Circle^ CL = C->Clone(C->Radius); // Clone and radius are members of the class Circle
}
The above code works because I created C again.
The following code will not work:
button1->clicked(...)
{
Circle CL = C->Clone(C->Radius);
}