Design Patterns

  • Thread starter Thread starter Mr.Tickle
  • Start date Start date
M

Mr.Tickle

How can I impleement a singleton pattern in an abstract or interface for
inheritance to an object so all the pattern rules are followed on all
similar objects?
 
Bugger, so we have to do it on a class by class basis :|

meh, how does Templates in MC++ and generics share when C# gets generics?
Can C# then use the MC++ templates?
 
Generics in .NET languages aren't (or won't be) the same thing as
(non-managed) C++ templates. Having said that, it makes sense that there
should be CLS rules that enable generics in various .NET languages to work
together - otherwise it will be difficult to have generic collection
containers in the new framework. Since the generic is written into IL in its
generic form, then resolved when jitted, the intent is to have interop
across languages.

BTW, Eiffel has generics on .NET today - it's basically just an intelligent
expansion of the generic Eiffel source code into non-generic IL.
 
So today I code the singleton design pattern into each object and wait for
2004 generics then I can make a pattern and implement that on every object I
need.

It would be real nice to say here is my class, and its inheriting a pattern
of usage from a Singleton class. Im supprised .NET doesnt come with built
in design patterns. It really seems to be a rushed out web service prioroty
release atm, half the shit aint managed, I always have to drop down to
platform invoke for alot of functionality.

When will we be getting serial communication rather than relying on pinvoke
wrappers for one example.

Is there a roadmap on what platform features that will be implemented in
future releases so we can plan for that?
 
In the constructor, can't you call up to base() that implements the
singleton? Can't enforce child will call base, but you at least you don't
have to implement it in all child classes.
public abstract class parent
{
public parent()
{
//do singleton pattern
}
}
public class child:parent
{
public child():base()
{
//base .ctor runs...
//Do other child instance stuff...
}
}
 
MC++ (Managed Extenstions for C++) wont have C++ templates, only generics are supported for all (MS) managed languages

Willy.
 
Back
Top