Re: Question about Typesafe Enums



Planet[] planets=
{
new Planet("Mercury", 3.303e+23, 2.4397e6, 0),
new Planet("Venus", 4.869e+24, 6.0518e6, 0),
new Planet("Earth", 5.976e+24, 6.37814e6, 1),
new Planet("Mars", 6.421e+23, 3.3972e6, 1)
};

final class Planet
{
private final String name;
private final double mass;
private final double radius;
private final int satellites;

public Planet
(final String name,final double mass,final double radius,final
int satellites)
{
this.name=name;
this.mass=mass;
this.radius=radius;
this.satellites=satellites;
}

public String getName()
{
return name;
}

public double getMass()
{
return mass;
}

public double getRadius()
{
return radius;
}

public int numberOfSatellites()
{
return satellites;
}
}

Find a tutorial on OOP sometime.

.



Relevant Pages

  • Re: common dialog w/api instead of COMDLG32.OCX, possible?
    ... As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As ... Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias ... Public Property Get FileNameAs String ...
    (microsoft.public.vb.winapi)
  • Re: Incompatibility between Access 2003 and Access 2002
    ... Private WithEvents mlst As ListBox ... Private mot As ObjectType ... Public DisplayField As String ... Dim prm As DAO.Parameter ...
    (microsoft.public.access.modulesdaovba)
  • Re: GetOpenFilename With MultiSelect Intermittently Returns String
    ... ByVal lpWindowName As String) As Long ... Private Declare Function lstrlen Lib "kernel32" _ ... Private Const OFN_ALLOWMULTISELECT As Long = &H200 ...
    (microsoft.public.excel.programming)
  • Re: Getting Windows Display Name
    ... Private Type WKSTA_USER_INFO_1 ... usri3_script_path As Long 'Pointer to a Unicode string specifying the path for the user's logon script file. ... Dim bufptr As Long ... Public Property Get PasswordAgeAs Long ...
    (microsoft.public.access.modulesdaovba)
  • Re: FTP-Service throgh WinInet-API
    ... Dim sTmpPath As String: sTmpPath = AppPath) ... Private hInternet As Long ... Public Declare Function InternetCloseHandle _ ...
    (microsoft.public.vb.general.discussion)