I have a super class: public static class StructClass(){} // this is empty
Now a class is declared which is extends a Structclass:
Code:public static class myStruct extends structClass {
public DV v1 = new DV(..);
public DV v2 = new DV(..);
public myStruct(DV v1copy, DV v2copy) {
v1 = v1copy;
v2 = v2copy;
}
}
DV is a class object I have created.
Now I am declaring a myStruct variable:
DV myS = new DV(4, "shared", (structClass)new myStruct(DV.Constant(1), DV.Constant(2)));
This DV is different. The DV function is:
Code:public DV(int vtype, String scope, structClass value) {
......
DVStructVal = new StructClass();
DVStructVal = value;
}
This is compiling fine. I need the super class to generalize the DV function for different classes like myStruct classes declared. But, this way I cannot access the class variable.
I am trying: myS.DVStructVal.v1. I am getting the error that v1 does not exist. myS.v1 is also not working. Does this mean DVStructVal is just a structClass and not myStruct. How can I access v1 and v2?
I need a generalized class. The DV class is needed. I am supposed to declare different classes like myStruct class and use the same DV class for them. Can you help me with that?
Any help will be appreciated! Thanks!
Kajari
