C++ vs JAVA

Hmm...I don't think I did?

In reading my post again, it didn't seem very clear. For the heck of it, let me try again with a more clear head.

C# allows you to define properties for classes, unlike Java. What's a property? Try this.

class Employee
{
private string m_name = "";

public string Name
{
get { return m_name; }
set { m_name = value; }
}
}

If I were to create an Employee object:

Employee emp = new Employee();

...I could now easily get/set the value:

emp.Name = "Typedef Enum"; // Set the value

Console.WriteLine("Employee name: " + emp.Name); // Get the value

OK. If I wanted to use reflection to, say, query an object of type Employee:

System.Type t = emp.GetType();

Likewise, if I didn't have an employee object instanciated, I could also achieve the same thing with the following:

System.Type t = typeof(Employee);

Either way, I now have a type object. With a type object, you can now use reflection in a variety of ways to discover "things" about the type, such as:

- Is it an interface?
- Is it an abstract class?
- What are the property(s) names?
- What are the member function names?
- What are the fields?

etc. etc.

Using the example I gave before, I could do something like this.

(Note: Calling the GetProperties() function on class Type will return an array of PropertyInfo objects)

foreach (PropertyInfo pi in t.GetProperties())
{
Console.WriteLine("This property name is: " + pi.Name);
}

If I were to execute that code, it would spit out:

"This property name is: Name"

It's a very powerful feature, and one that's used throughout .NET (in particular), as well as Java. In fact, .NET Studio 2003 uses reflection a _lot_ in order to accomplish a lot of "things" within the IDE itself. It's also used quite a bit once you start using ADO.NET, especially once you begin the process of binding Control objects/classes with Data objects. That is to say, it's used to link pure data classes (collections, DataSets, tables, databases, etc) and UI components that display the data, even when the UI components have no preconceived knowledge about the structure of the data. The prime example is the DataGrid.

The DataGrid UI component is able to present data in a table, with column headers/etc. because it uses reflection to "inspect" the data structures to pull out this information.
 
Dig up a very old thread in order to say that?

Either way, Java OpenGL apps have great speed on a gaming PC and games can be made using Java from the ground up and have excellent performance.

Try LWJGL, JOGL, jME, Java3D, Xith3D.
 
K.I.L.E.R said:
Dig up a very old thread in order to say that?

Either way, Java OpenGL apps have great speed on a gaming PC and games can be made using Java from the ground up and have excellent performance.

Try LWJGL, JOGL, jME, Java3D, Xith3D.

No! Not Java3D!
Eh, my final project for my AP Computer Science class was in Java3D, and it wasn't anything like I'd done before. It is an evil wrapper class, EVIL!
Not sure about the performance, but in comparison to normal Java programs I'd seen in my class it had very good performance for what it was doing.
 
There are like 100 alternatives to Java3D.
Try one of them, they're all different to suit different tastes.

Fox5 said:
K.I.L.E.R said:
Dig up a very old thread in order to say that?

Either way, Java OpenGL apps have great speed on a gaming PC and games can be made using Java from the ground up and have excellent performance.

Try LWJGL, JOGL, jME, Java3D, Xith3D.

No! Not Java3D!
Eh, my final project for my AP Computer Science class was in Java3D, and it wasn't anything like I'd done before. It is an evil wrapper class, EVIL!
Not sure about the performance, but in comparison to normal Java programs I'd seen in my class it had very good performance for what it was doing.
 
Back
Top