-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: MohangandhiC
Message 3 in Discussion
Hi, The first point is, as we are forcing to inherit class by saying
"Abstract" in same way we can force the developer not to inherit a class by
specifying "Sealed". We can just use it for creating instances. The next
important point comes in design patterns. Look at the following explanation:
Singleton Pattern:
Intent: Ensure a class only has one instance, and provide a global point of
access to it [GoF]. In earlier days we need to implement in the following
way: // Declaration
class Singleton {
public:
static Singleton* Instance();
protected:
Singleton();
private:
static Singleton* _instance;
} // Implementation
Singleton* Singleton::_instance =
0; Singleton* Singleton::Instance() {
if (_instance == 0) {
_instance = new Singleton;
}
return _instance;
} Now by using sealed we have advantage of using in the following way:
// .NET Singleton
sealed class Singleton
{
private Singleton() {}
public static readonly Singleton Instance = new Singleton();
}
Its very simple to implement by using sealed class. Get more clarity in the
following article: http://msdn2.microsoft.com/en-us/library/ms954629.aspx
Thanks, MohanGandhi. C
PlumArc <[EMAIL PROTECTED]> wrote: New Message on BDOTNET
Use of Sealed Class
Reply
Reply to Sender Recommend Message 2 in Discussion
From: PlumArc
Hi Ramesh,
Its like a FINAL Class in Java . In other words . As you told it cant be
inherited , and the same rule u want to apply for a class , u can use
SEALED Classes.
Thanks and Regards
S.Rajinigandh
Société Générale Global Solution Centre Pvt. Ltd.
Corporate and Investment Banking
http://www.socgensolutions.com
|------------------------------
| [EMAIL PROTECTED]
| com
|
| 02/19/2007 02:20
| PM
|
|
| Please respond to
| [EMAIL PROTECTED]
| n.com
|
|
To
[email protected]
cc
Subject
Use of Sealed Class
-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Ramezh1
Message 1 in Discussion
Hi, Sealed class can not be inherited from other classes.
Then what is
use of sealed class in .Net? Thanks, Ramesh.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your
E-mail Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On
the pre-addressed e-mail message that opens, simply click "Send". Your
e-mail address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]
*************************************************************************
This message and any attachments
(the "message") are confidential and intended solely for the addressee(s).
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to
alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be
liable for the message if altered, changed or
falsified.
************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses
destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout
message electronique est susceptible d'alteration.
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de
ce message s'il a ete altere, deforme ou falsifie.
*************************************************************************
View other groups in this category.
Cheers, MohanGandhi. C<o:p></o:p>
Need Mail bonding?
Go to the Yahoo! Mail Q for great tips from Yahoo! Answers users.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]