473,796 Members | 2,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

create reflection in java class ?

79 New Member
I read a Java class example on tutorial book. What is the part marked with asterisks doing? What is "create reflection of element" in java? Any analogy in C++?

its structure is like the following:

public class Element {

............... ............... .
.......blabla.. .....blabla
............... ............... .
declare variables
default constructor
constructor
accessor methods
............... ............... .
.......blabla.. .....blabla
............... ............... .

*************** *************** *************** ************
public Element createReflect() {
short [][] rMatrix = new short [height][width];
............... .......
int rVC = height -1;
int rVH = width -1;

return new Element (rMatrix, rVC, rHC);
}
*************** *************** *************** ************
}
Mar 22 '07 #1
1 1412
r035198x
13,262 MVP
I read a Java class example on tutorial book. What is the part marked with asterisks doing? What is "create reflection of element" in java? Any analogy in C++?

its structure is like the following:

public class Element {

............... ............... .
.......blabla.. .....blabla
............... ............... .
declare variables
default constructor
constructor
accessor methods
............... ............... .
.......blabla.. .....blabla
............... ............... .

*************** *************** *************** ************
public Element createReflect() {
short [][] rMatrix = new short [height][width];
............... .......
int rVC = height -1;
int rVH = width -1;

return new Element (rMatrix, rVC, rHC);
}
*************** *************** *************** ************
}
What do you think it's doing here? The method is not part of the java API but is a programmer defined method and so you cannot really expect to get an analogy in c++.
Mar 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2218
by: Tim Werth | last post by:
I am trying to use reflection to add an event handler for the RowUpdated event of the OracleDataAdapter object (ODP.NET), but the same thing can be said for SqlDataAdapter if you only use reflection. The code I supplied is based on the SqlDataAdapter with reflection. The error occurs when trying to create the delegate that will be passed in to EventInfo.AddEventHandler. I get the following error: An unhandled exception of type...
7
4155
by: sujit | last post by:
Hi All, I have query regarding "C++ and Reflection". I could not get sufficient information from net on this topic. Does C++ support reflection or any features similar to some other languages like Java? As far as I understand C++ does support a feature on RTTI. At lest I have not used it for anything more than simple object identidy
5
1924
by: Mountain Bikn' Guy | last post by:
How would I do this? public sealed class UtilityClass { public static MyObject Object1;//see note below about importance of static object names in this class public static MyObject Object2; // ... public static MyObject Object400;
7
6788
by: pmclinn | last post by:
I was wondering if it is possible to dynamically create a structure. Something like this: public sub main sql = "Select Col1, Col2 from Table a" dim al as new arraylist al = LoadOracleData(sql) '____Do amazing things
24
2845
by: M O J O | last post by:
Hi, Instead of doing this.... Public Class Form1 Public Shared Sub CreateAndShow() Dim f As New Form1 f.Show() End Sub
2
6593
by: Angel Of Death | last post by:
I have a method. It takes some XML as a parameter. Depending on the content of the XML it should create a specific object and call a KNOWN method. So: public void PersistXml(string XmlData){} I then determine what object I should call the Persist method on using a switch statement (not very OO). switch (otype)
0
1464
by: ranadhirnag | last post by:
I need to check a property in the javax.faces.component.html.HtmlInputText. If i do it in the following manner,I get things fine: if(comp.getClass().getName().equalsIgnoreCase("javax.faces.component.html.HtmlInputText")) { String getter=((javax.faces.component.html.HtmlInputText)comp).getOnfocus(); if(getter!=null) { System.out.println(getter); } }
5
4471
by: Sergio Montero | last post by:
I have a MustInherits Base class that implements a custom IDataLayer interfase. IDataLayer expose CRUD methods. Base class constructor requires two parameters: ConnectionString TableName Another assembly, sharing the root namespace, contains a set of Custom attributes used to validate properties values, just like the Validation Application Block.
8
3865
by: =?Utf-8?B?U2hhd24=?= | last post by:
Hi; i just started research reflection and i'm wondering if i have an empty class file can i use reflection to add member variables and attributes dynamically and then instantiate the class? What i would like to be able to do is start with and empty class, then depending on the data provided to me by a config file, add the member variables and attributes to the class temporarily. when the app is shutdown all changes would be gone. can...
0
10467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10201
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.