我正在开发一个房屋租赁/销售应用程序,它将允许用户发布租赁和房屋出售。我关注的是两个对象有一些相似和不同的属性,例如这里的房子租金可以有以下属性`
public class RentalHouse extends Property{
private int numOfBedrooms;
private int payMonthsInAdvance;
private double securityDeposit;
private double rentals;
private String dayOfVacancy;
}
虽然出售的房屋可以具有以下属性
public class SaleHouse extends Property{
private int numOfBedrooms;
private double price;
}
public class Property {
private long id;
private String title;
private String description;
private ArrayList<String> images;
private String province;
private String area;
}
现在这是我的问题;对于rental houses
而另一个用于houses on sale
而另一个用于[DllImport( "user32.dll", EntryPoint = "GetWindowLongPtr" )]
public static extern IntPtr GetWindowLongPtr( IntPtr hWnd, GWL nIndex );
[DllImport( "user32.dll", EntryPoint = "SetWindowLongPtr" )]
public static extern IntPtr SetWindowLongPtr( IntPtr hWnd, GWL nIndex, IntPtr dwNewLong );
const long WS_EX_TOPMOST = 0x00000008L;
public enum GWL : int
{
GWL_WNDPROC = (-4),
GWL_HINSTANCE = (-6),
GWL_HWNDPARENT = (-8),
GWL_STYLE = (-16),
GWL_EXSTYLE = (-20),
GWL_USERDATA = (-21),
GWL_ID = (-12)
}
public static void SetToolWindow( Window window )
{
var wih = new WindowInteropHelper( window );
var style = GetWindowLongPtr( wih.Handle, GWL.GWL_EXSTYLE );
style = new IntPtr( style.ToInt64() | WS_EX_TOPMOST );
SetWindowLongPtr( wih.Handle, GWL.GWL_EXSTYLE, style );
}
是一个好的设计吗?你会建议什么?