Skip to main content

[BD-J-DEV] Private attributes and object literals...

1 reply [Last post]
Anonymous

Hi,

A newbie question on initializing private attributes within object
literals: Private attributes can not be initialized in an object
literals defined in a different compilation unit. But, it is okay to
initialize private attributes in object literals defined in the same
compilation unit. Is that the language rule?

Example: The attached Person.fx compiles without errors. But, if we
compile Person.fx and Main.fx together, we get a compilation error on
Main.fx at object literal.

Thanks,
-Sundar
var o = Person {
name : "Sundar",
age: 2
}
public class Person {
private attribute name : String;
public attribute age : Integer;
}

var p = Person {
name: "Sun",
age: 20
}

---------------------------------------------------------------------
To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sundararajana
Offline
Joined: 2004-05-26

Hi,

I'm sorry. Please ignore my question. It was intended for a different forum.

-A. Sundararajan