Difference between Events and Delegates

  S.No    Events                                Delegates
  1       Event can be used in an               Delegate cannot be used in an
          interface definition                  interface definition

  2       Event can only be invoked from        Delegates can be invoked from child
          the class that declares it            classes and clients.

  3       Event comes with its pair of          There is no pair of accessors concept
          accessors i.e Add and Remove.         in delegates.
          An event is always assigned and
          unassigned with a += and -=
          operator.
  4       Event has a restrictive signature     Delegates do not have restrictive
          and must always be of the form
                                                signature as like events
          Event (object source, EventArgs
          args)

Difference between Class and Object

  S.No     Class                                    Object
  1        It is a datatype that contains the       It is a chunk of memory that
           programming logic.                       implements the class logic.
  2        Class is visible in the source code      Object is in the RAM and not
           and resides in hard disk.                visible in source code.
  3        Class is like a template or blueprint    It is the real world implementation
           of the object. It implements             of the class. Each object has its
           reusability,encapsulation,               own copy of data.
           inheritance
  4        Example:Button is a class with           Example: Button1, Button2 are the
           properties like Text,BackColor,          objects of Button class.
           events like click, methods like
           Focus
  5        We can create subclasses                 We cannot create sub-objects

Difference between Private and Static Constructor
 S.No       Static constructor               Private constructor

 1          A static constructor is called         Private constructor is called after the
            before the first instance is           instance of the class is created.
            created. i.e. global initializer.
 2          Static constructor will be called      Static members will not be initialized
            first time when the class is           either by private or public
            referenced.Static constructor is       constructor.
            used to initialize static members
            of the class.
 3          The static constructor will only be The private constructor will be
            executed once.                      executed each time it is called.
Difference between properties and methods

    S.No     Properties                            Methods
    1        Properties are used to represent      Methods are used to performs actions
             data
    2        Properties are created by using       Methods create like public void
             getter and setter i.e., get{} and     method1(parameter list here)
             set{}


Difference between Singleton Pattern and a static class

S.No       Singleton Pattern                       static class

           Singleton pattern maintains single      We cannot create instance for static
           instance.                               class.
2          A singleton can extend classes and A static class cannot .
           implement interfaces.              Note: It can extend classes, but it
                                              does not inherit their instance
                                              members.
3          A singleton can be initialized lazily   A static class is generally initialized
           or asynchronously.                      when it is first loaded, leading to
                                                   potential class loader issues.
4          Singletons can be handled               static class cannot be handled
           polymorphically without forcing         polymorphically.
           their users to assume that there is
           only one instance.
5          Singleton Class can have value          Static are always just shared and have
           when Class object instantiated          no instance but multiple references.
           between server and client, such a
           way if three client want to have a
           shared data between them
           Singleton can be used.Thats why
           singleton class can be used for
           state mangement in stateless
           scenarios like shopping cart
           scenario.
6          We can pass singleton object as         We cannot pass parameter in static
           parameter                               class
7          Singleton provides flexibility and      Static classes once defined could not
           also provides sort of a mechanism       accomodate any future design
           to control object creation based on     changes as by design static classes
           various requirements. They can be       are rigid and cannot be extended.
           extended as well if need arises. In
           other words we are not always tied
           to a particular implementation.
           With Singleton we have the
           flexibility to make changes as when
           situation demands.
OOPs difference faqs- 2

More Related Content

PPTX
Singleton Pattern (Sole Object with Global Access)
PPTX
Design Pattern - Singleton Pattern
PPTX
Singleton Design Pattern - Creation Pattern
PPT
Ruby Metaprogramming
DOC
Java classes and objects interview questions
PDF
Java - Singleton Pattern
PPTX
Singleton Pattern
PDF
Java unit 7
Singleton Pattern (Sole Object with Global Access)
Design Pattern - Singleton Pattern
Singleton Design Pattern - Creation Pattern
Ruby Metaprogramming
Java classes and objects interview questions
Java - Singleton Pattern
Singleton Pattern
Java unit 7

Viewers also liked (14)

PDF
Wcf difference faqs-1
PDF
Dotnet differences
PDF
Asp.Net difference faqs- 4
PDF
PPT
DOCX
Interview Question of Aspdotnet
PDF
Dotnet difference between
PPT
Javascript quiz. Questions to ask when recruiting developers.
PDF
Javascript quiz
PDF
Html interview-questions-and-answers
PDF
Dotnet difference questions and answers compiled- 1(updated-2)
DOC
DOCX
Multiple choice questions with answers
DOCX
Bit%20 ch02
Wcf difference faqs-1
Dotnet differences
Asp.Net difference faqs- 4
Interview Question of Aspdotnet
Dotnet difference between
Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz
Html interview-questions-and-answers
Dotnet difference questions and answers compiled- 1(updated-2)
Multiple choice questions with answers
Bit%20 ch02
Ad

Similar to OOPs difference faqs- 2 (20)

PDF
OOPs difference faqs-3
PDF
Design patterns difference between interview questions
PDF
OOPs Difference FAQs
PPT
OO Development 4 - Object Concepts
PDF
6 class and methods
PPTX
OOP Presentation.pptx
PPTX
OOP Presentation.pptx
PPT
DOCX
Question and answer Programming
PPTX
Introduction to oop
PPTX
Quick Interview Preparation for C# All Concepts
PPTX
Object oriented programming 3 object oriented concepts
DOC
PDF
OOPs reasoning faqs- 1
PPTX
Object Oriented Principles
PPTX
Fundamentals of oops in .Net
DOCX
Object oriented basics
PPT
Object Oriented Relationships
OOPs difference faqs-3
Design patterns difference between interview questions
OOPs Difference FAQs
OO Development 4 - Object Concepts
6 class and methods
OOP Presentation.pptx
OOP Presentation.pptx
Question and answer Programming
Introduction to oop
Quick Interview Preparation for C# All Concepts
Object oriented programming 3 object oriented concepts
OOPs reasoning faqs- 1
Object Oriented Principles
Fundamentals of oops in .Net
Object oriented basics
Object Oriented Relationships
Ad

More from Umar Ali (20)

PDF
Difference between wcf and asp.net web api
PDF
Difference between ActionResult() and ViewResult()
PDF
Difference between asp.net mvc 3 and asp.net mvc 4
PDF
Difference between asp.net web api and asp.net mvc
PDF
Difference between asp.net web forms and asp.net mvc
PDF
ASP.NET MVC difference between questions list 1
ODT
Link checkers 1
PDF
Affiliate Networks Sites-1
PDF
Technical Video Training Sites- 1
PDF
US News Sites- 1
PDF
How to create user friendly file hosting link sites
PDF
Weak hadiths in tamil
PDF
Bulughul Maram in tamil
PDF
Asp.net website usage and job trends
PDF
Indian news sites- 1
PDF
Photo sharing sites- 1
PDF
File hosting search engines
PDF
Ajax difference faqs compiled- 1
PDF
ADO.NET difference faqs compiled- 1
PDF
Dotnet differences compiled -1
Difference between wcf and asp.net web api
Difference between ActionResult() and ViewResult()
Difference between asp.net mvc 3 and asp.net mvc 4
Difference between asp.net web api and asp.net mvc
Difference between asp.net web forms and asp.net mvc
ASP.NET MVC difference between questions list 1
Link checkers 1
Affiliate Networks Sites-1
Technical Video Training Sites- 1
US News Sites- 1
How to create user friendly file hosting link sites
Weak hadiths in tamil
Bulughul Maram in tamil
Asp.net website usage and job trends
Indian news sites- 1
Photo sharing sites- 1
File hosting search engines
Ajax difference faqs compiled- 1
ADO.NET difference faqs compiled- 1
Dotnet differences compiled -1

Recently uploaded (20)

PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PPTX
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
PDF
Launch a Bumble-Style App with AI Features in 2025.pdf
PDF
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PDF
EIS-Webinar-Regulated-Industries-2025-08.pdf
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PPTX
Blending method and technology for hydrogen.pptx
PDF
The AI Revolution in Customer Service - 2025
PDF
Altius execution marketplace concept.pdf
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PDF
CEH Module 2 Footprinting CEH V13, concepts
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
Connector Corner: Transform Unstructured Documents with Agentic Automation
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
Launch a Bumble-Style App with AI Features in 2025.pdf
ment.tech-Siri Delay Opens AI Startup Opportunity in 2025.pdf
Introduction to MCP and A2A Protocols: Enabling Agent Communication
EIS-Webinar-Regulated-Industries-2025-08.pdf
Rapid Prototyping: A lecture on prototyping techniques for interface design
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
Blending method and technology for hydrogen.pptx
The AI Revolution in Customer Service - 2025
Altius execution marketplace concept.pdf
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
CEH Module 2 Footprinting CEH V13, concepts
Data Virtualization in Action: Scaling APIs and Apps with FME
Build automations faster and more reliably with UiPath ScreenPlay
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf

OOPs difference faqs- 2

  • 1. Difference between Events and Delegates S.No Events Delegates 1 Event can be used in an Delegate cannot be used in an interface definition interface definition 2 Event can only be invoked from Delegates can be invoked from child the class that declares it classes and clients. 3 Event comes with its pair of There is no pair of accessors concept accessors i.e Add and Remove. in delegates. An event is always assigned and unassigned with a += and -= operator. 4 Event has a restrictive signature Delegates do not have restrictive and must always be of the form signature as like events Event (object source, EventArgs args) Difference between Class and Object S.No Class Object 1 It is a datatype that contains the It is a chunk of memory that programming logic. implements the class logic. 2 Class is visible in the source code Object is in the RAM and not and resides in hard disk. visible in source code. 3 Class is like a template or blueprint It is the real world implementation of the object. It implements of the class. Each object has its reusability,encapsulation, own copy of data. inheritance 4 Example:Button is a class with Example: Button1, Button2 are the properties like Text,BackColor, objects of Button class. events like click, methods like Focus 5 We can create subclasses We cannot create sub-objects Difference between Private and Static Constructor S.No Static constructor Private constructor 1 A static constructor is called Private constructor is called after the before the first instance is instance of the class is created. created. i.e. global initializer. 2 Static constructor will be called Static members will not be initialized first time when the class is either by private or public referenced.Static constructor is constructor. used to initialize static members of the class. 3 The static constructor will only be The private constructor will be executed once. executed each time it is called.
  • 2. Difference between properties and methods S.No Properties Methods 1 Properties are used to represent Methods are used to performs actions data 2 Properties are created by using Methods create like public void getter and setter i.e., get{} and method1(parameter list here) set{} Difference between Singleton Pattern and a static class S.No Singleton Pattern static class Singleton pattern maintains single We cannot create instance for static instance. class. 2 A singleton can extend classes and A static class cannot . implement interfaces. Note: It can extend classes, but it does not inherit their instance members. 3 A singleton can be initialized lazily A static class is generally initialized or asynchronously. when it is first loaded, leading to potential class loader issues. 4 Singletons can be handled static class cannot be handled polymorphically without forcing polymorphically. their users to assume that there is only one instance. 5 Singleton Class can have value Static are always just shared and have when Class object instantiated no instance but multiple references. between server and client, such a way if three client want to have a shared data between them Singleton can be used.Thats why singleton class can be used for state mangement in stateless scenarios like shopping cart scenario. 6 We can pass singleton object as We cannot pass parameter in static parameter class 7 Singleton provides flexibility and Static classes once defined could not also provides sort of a mechanism accomodate any future design to control object creation based on changes as by design static classes various requirements. They can be are rigid and cannot be extended. extended as well if need arises. In other words we are not always tied to a particular implementation. With Singleton we have the flexibility to make changes as when situation demands.