If i've got a class, can i have a static method in that class that returns an instace of the class itself?
I'm trying to build a static method on the class that can act as a sort of database lookup - i.e. people could call
Subscription.returnExistingSubscriptionFromDatabase("test006") - and get a Subscription object with its properties populated from the database. Can i do this?
private class Subscription()
private string property1
private string property2
// static method taht could be used to return an instance of this class
public static subscription returnExistingSubscriptionFromDatabase(String uniqueIdentifier)
// look up database to find the data for property1 and property2
// return by calling the class constructor
return subscription(valueFromDatabase1, valueFromDatabase2)
public subscription(string prop1, string prop2)
this.property1 = prop1
this.property2 = prop2