0

I am using a language called OX. It's an objected oriented matrix programming language. I am new to OOP. I have a few elementary questions. Since the language does not have a debug mode, I need to print out variables to debug. Please correct me if I am wrong in the following statement.

  1. If I define a variable in the header file, say P1. And the class is MNP. Then in my main function, I could print the variable as print (MNP::P1) .

  2. When an source is compiled as an object file, the print command in the object file will not be shown in the output window. So the only way to print is in the main function.

I am very new to the language. I am not sure if I have provided all information. Please correct me if I am not giving enough information.

Malick
  • 6,252
  • 2
  • 46
  • 59
Yan Song
  • 112
  • 2
  • 13

1 Answers1

0

1. There is a decent documentation. As far as I understood it MNP::P1 will not compile. The reason is, that a class only defines what an object looks like. In this case any object of class MNP will have a member P1. However, the class itself has no objects, therefore MNP::P1 is not a variable you can print. In C++ you could make P1 static, but that is not supported in OX. Instead you need to make an object like so:

decl mnpobj = new MNP(0);
print(mnpobj.P1);

Make sure that P1 inside of class MNP is declared public, otherwise you will get some kind of access violation error message.

Point 2. may come later.

nwp
  • 9,623
  • 5
  • 38
  • 68