SlideShare una empresa de Scribd logo
1 de 16
Object-Oriented Programming Using C#
Objectives


                In this session, you will learn to:
                   Use abstract classes
                   Use sealed classes
                   Use interfaces
                   Implement the file input and output operations




     Ver. 1.0                        Session 11                     Slide 1 of 16
Object-Oriented Programming Using C#
Using Abstract Classes


                C# enables you to create abstract classes that are used to
                provide partial class implementation of an interface.
                Abstract classes contain abstract methods, which can be
                implemented by the derived class.
                Polymorphism can be implemented by using abstract
                classes and virtual functions.
                There are certain rules governing the use of an abstraction
                class:
                   Cannot create an instance of an abstract class.
                   Cannot declare an abstract method outside an abstract class.
                   Cannot be declared sealed.




     Ver. 1.0                       Session 11                          Slide 2 of 16
Object-Oriented Programming Using C#
Using Abstract Methods


                Abstract methods are methods without any body.
                The implementation of an abstract method is done by the
                derived class.
                When a derived class inherits the abstract method form the
                abstract class, it must override the abstract methods. This
                requirement is enforced at compile time, and is also called
                dynamic polymorphism.
                The syntax for using the abstract method is as follows:
                 [access-modifiers] abstract return-type method
                 name (parameters]);
                The abstract method is declared by adding the abstract
                modifier to the method.




     Ver. 1.0                      Session 11                        Slide 3 of 16
Object-Oriented Programming Using C#
Using Virtual Functions


                • When you have a function defined in a class which you
                  want to allow to be implemented by the inherited classes,
                  you can use virtual function.
                • The virtual function could be implemented by the
                  inherited classes in their own way and the call to the
                  method is decided at the run time.




     Ver. 1.0                        Session 11                        Slide 4 of 16
Object-Oriented Programming Using C#
Using Sealed Classes


                • You could restrict users form inheriting the class by sealing
                  the class using the sealed keyword.
                • The sealed keyword tells the compiler that the class is
                  sealed, and therefore, cannot be extended.
                • The following is an example of a sealed class:
                    sealed class FinalClass
                    {
                      private int x;
                      public void Method1()
                      {
                      }
                    }
                   A method can also be sealed and in that case the method
                   cannot be overridden.

     Ver. 1.0                         Session 11                         Slide 5 of 16
Object-Oriented Programming Using C#
Using Interfaces


                Interfaces define properties, methods, and events, which
                are known as the members of the interface.
                Interfaces are fully supported by C#.
                Interfaces are used when a standard structure of methods is
                to be followed by the classes, and where classes will
                implement the functionality.
                Interfaces separate the definition of objects from their
                implementation so that the objects can evolve without the
                risk of introducing incompatibility in existing applications.




     Ver. 1.0                      Session 11                        Slide 6 of 16
Object-Oriented Programming Using C#
Working with Interfaces


                • Working with interfaces includes interface declaration and
                  implementation of interface by the classes.
                • You can declare interfaces using the interface keyword.
                • Interface statements are public, by default.
                • You can declare only methods, functions, and properties in
                  interfaces. You cannot declare a variable in interfaces.
                • Interfaces declare methods, which are implemented by
                  classes. A class can inherit from single class but can
                  implement form multiple interfaces.




     Ver. 1.0                        Session 11                       Slide 7 of 16
Object-Oriented Programming Using C#
Inheriting Interfaces


                A class or a structure that implements interfaces also
                implements the base interfaces of the inherited interface.




     Ver. 1.0                      Session 11                         Slide 8 of 16
Object-Oriented Programming Using C#
Demo: Order-Processing System Using Abstract Classes


                Problem Statement:
                   Furniture and Fittings Company (FFC) manufactures domestic
                   furniture. Customers provide their specifications to the
                   company for the furniture they want. To cope with the received
                   customer’s orders, FFC decides to computerize the
                   order-processing system. The system should accept the values
                   of furniture items, such as a bookshelf and a chair. You need
                   to develop the hierarchy of these items.




     Ver. 1.0                       Session 11                           Slide 9 of 16
Object-Oriented Programming Using C#
Demo: Order-Processing System Using Abstract Classes (Contd.)


                Solution:
                   To create a console based application for FFC, you need to
                   perform the following tasks:
                    1. Create a console-based application.
                    2. Build and execute an application.




     Ver. 1.0                        Session 11                         Slide 10 of 16
Object-Oriented Programming Using C#
Implementing the File Input and Output Operations


                • The stream is a sequence of bytes traveling from a source
                  to a destination over a communication path.
                • The two basic streams used are the input and output
                  streams.
                • An input stream is used for a read operation and an output
                  stream is used for performing a write operation.
                • The System.IO namespace includes various classes, which
                  are used to perform operations, such as file creation, file
                  deletion, and the read-write operations to files.




     Ver. 1.0                        Session 11                       Slide 11 of 16
Object-Oriented Programming Using C#
FileStream Class


                • To open an existing file or to create a new file, you need to
                  create an object of type FileStream.
                • Consider the following syntax for creating the object of type
                   FileStream:
                    FileStream <object name>=new FileStream(<file
                    Name>,<FileMode Enumerator>,<File Access
                    Enumerator>,<FileShare Enumerator>);




     Ver. 1.0                         Session 11                        Slide 12 of 16
Object-Oriented Programming Using C#
FileStream Class (Contd.)


                • FileMode enumerator defines various methods for opening
                    files.
                •   The FileMode enumerator parameter is specified in many
                    constructors for the FileStream.
                •   The parameters to FileMode checks whether a file is
                    overwritten, created, or opened.
                •   FileAccess enumerator indicates whether you want to read
                    data from the file, write to the file, or perform both the
                    operations.
                •   The members of the FileAccess enumerator are Read,
                    ReadWrite, and Write.




     Ver. 1.0                         Session 11                       Slide 13 of 16
Object-Oriented Programming Using C#
FileStream Class (Contd.)


                The FileShare enumerator contains constants for
                controlling the kind of access that the other FileStream
                constructors can have to the same file.
                A typical use of this enumeration is to define whether two
                different applications can simultaneously read from the
                same file.




     Ver. 1.0                      Session 11                        Slide 14 of 16
Object-Oriented Programming Using C#
Summary


               In this session, you learned that:
                – An abstract superclass is a conceptual class that does not
                  exist in real world but acts as a base from which other classes
                  inherit properties behavior.
                – A sealed class tells the compiler that the class cannot be
                  extended further. You cannot derive a class from a sealed
                  class.
                – An interface defines properties, methods, and events. The
                  properties, methods, and events that are defined in the
                  interface are known as the members of the interface.
                – A stream is an abstraction of a sequence of bytes traveling
                  from a source to a destination over a communication path.




    Ver. 1.0                        Session 11                           Slide 15 of 16
Object-Oriented Programming Using C#
Summary (Contd.)


               – The two basic streams used are the input and output streams.
                 An input stream is used for a read operation and an output
                 stream is used for performing a write operation.
               – Most file input/output (I/O) support in the .NET Framework is
                 implemented in the System.IO namespace. You can use the
                 FileStream class in the System.IO namespace to read
                 from, to write, and to close files.
               – The FileStream class inherits from the abstract class
                 Stream.




    Ver. 1.0                      Session 11                           Slide 16 of 16

Más contenido relacionado

La actualidad más candente

11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16Niit Care
 
13 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_1913 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_19Niit Care
 
03 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_0403 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_04Niit Care
 
Java session02
Java session02Java session02
Java session02Niit Care
 
02 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_0202 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_02Niit Care
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTAtit Patumvan
 
4.class diagramsusinguml
4.class diagramsusinguml4.class diagramsusinguml
4.class diagramsusingumlAPU
 
Visualizing Stakeholder Concerns with Anchored Map
Visualizing Stakeholder Concerns with Anchored MapVisualizing Stakeholder Concerns with Anchored Map
Visualizing Stakeholder Concerns with Anchored MapTakanori Ugai
 
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionWin32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionAlex Matrosov
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of PatternsChris Eargle
 
Introduction to architectures based on models, models and metamodels. model d...
Introduction to architectures based on models, models and metamodels. model d...Introduction to architectures based on models, models and metamodels. model d...
Introduction to architectures based on models, models and metamodels. model d...Vicente García Díaz
 
Extension and Evolution
Extension and EvolutionExtension and Evolution
Extension and EvolutionEelco Visser
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 

La actualidad más candente (20)

11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16
 
01 gui 01
01 gui 0101 gui 01
01 gui 01
 
13 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_1913 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_19
 
03 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_0403 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_04
 
Java session02
Java session02Java session02
Java session02
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
02 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_0202 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_02
 
Dacj 1-2 a
Dacj 1-2 aDacj 1-2 a
Dacj 1-2 a
 
Csharp
CsharpCsharp
Csharp
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDT
 
Tutorial c#
Tutorial c#Tutorial c#
Tutorial c#
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
4.class diagramsusinguml
4.class diagramsusinguml4.class diagramsusinguml
4.class diagramsusinguml
 
Visualizing Stakeholder Concerns with Anchored Map
Visualizing Stakeholder Concerns with Anchored MapVisualizing Stakeholder Concerns with Anchored Map
Visualizing Stakeholder Concerns with Anchored Map
 
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionWin32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework Reconstruction
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of Patterns
 
Introduction to architectures based on models, models and metamodels. model d...
Introduction to architectures based on models, models and metamodels. model d...Introduction to architectures based on models, models and metamodels. model d...
Introduction to architectures based on models, models and metamodels. model d...
 
Extension and Evolution
Extension and EvolutionExtension and Evolution
Extension and Evolution
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 

Similar a 08 iec t1_s1_oo_ps_session_11

.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologiesprakashk453625
 
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013Steven Smith
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET rchakra
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1ReKruiTIn.com
 
C# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy todayC# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy todayAfonso Macedo
 
.Net framework
.Net framework.Net framework
.Net frameworkRaghu nath
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questionsvenkata52
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language Hitesh-Java
 
Session2 (3)
Session2 (3)Session2 (3)
Session2 (3)DrUjwala1
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview QuestionsSyed Shahul
 
Hibernate reference1
Hibernate reference1Hibernate reference1
Hibernate reference1chandra mouli
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIESProf Ansari
 

Similar a 08 iec t1_s1_oo_ps_session_11 (20)

.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013
 
C sharp
C sharpC sharp
C sharp
 
Kushal
KushalKushal
Kushal
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET
 
.Net slid
.Net slid.Net slid
.Net slid
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1
 
C# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy todayC# c# for beginners crash course master c# programming fast and easy today
C# c# for beginners crash course master c# programming fast and easy today
 
.Net framework
.Net framework.Net framework
.Net framework
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questions
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Session2 (3)
Session2 (3)Session2 (3)
Session2 (3)
 
Dot net
Dot netDot net
Dot net
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 
Hibernate reference1
Hibernate reference1Hibernate reference1
Hibernate reference1
 
.NET TECHNOLOGIES
.NET TECHNOLOGIES.NET TECHNOLOGIES
.NET TECHNOLOGIES
 
Objective-C
Objective-CObjective-C
Objective-C
 

Más de Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 
Dacj 1-2 c
Dacj 1-2 cDacj 1-2 c
Dacj 1-2 c
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

08 iec t1_s1_oo_ps_session_11

  • 1. Object-Oriented Programming Using C# Objectives In this session, you will learn to: Use abstract classes Use sealed classes Use interfaces Implement the file input and output operations Ver. 1.0 Session 11 Slide 1 of 16
  • 2. Object-Oriented Programming Using C# Using Abstract Classes C# enables you to create abstract classes that are used to provide partial class implementation of an interface. Abstract classes contain abstract methods, which can be implemented by the derived class. Polymorphism can be implemented by using abstract classes and virtual functions. There are certain rules governing the use of an abstraction class: Cannot create an instance of an abstract class. Cannot declare an abstract method outside an abstract class. Cannot be declared sealed. Ver. 1.0 Session 11 Slide 2 of 16
  • 3. Object-Oriented Programming Using C# Using Abstract Methods Abstract methods are methods without any body. The implementation of an abstract method is done by the derived class. When a derived class inherits the abstract method form the abstract class, it must override the abstract methods. This requirement is enforced at compile time, and is also called dynamic polymorphism. The syntax for using the abstract method is as follows: [access-modifiers] abstract return-type method name (parameters]); The abstract method is declared by adding the abstract modifier to the method. Ver. 1.0 Session 11 Slide 3 of 16
  • 4. Object-Oriented Programming Using C# Using Virtual Functions • When you have a function defined in a class which you want to allow to be implemented by the inherited classes, you can use virtual function. • The virtual function could be implemented by the inherited classes in their own way and the call to the method is decided at the run time. Ver. 1.0 Session 11 Slide 4 of 16
  • 5. Object-Oriented Programming Using C# Using Sealed Classes • You could restrict users form inheriting the class by sealing the class using the sealed keyword. • The sealed keyword tells the compiler that the class is sealed, and therefore, cannot be extended. • The following is an example of a sealed class: sealed class FinalClass { private int x; public void Method1() { } } A method can also be sealed and in that case the method cannot be overridden. Ver. 1.0 Session 11 Slide 5 of 16
  • 6. Object-Oriented Programming Using C# Using Interfaces Interfaces define properties, methods, and events, which are known as the members of the interface. Interfaces are fully supported by C#. Interfaces are used when a standard structure of methods is to be followed by the classes, and where classes will implement the functionality. Interfaces separate the definition of objects from their implementation so that the objects can evolve without the risk of introducing incompatibility in existing applications. Ver. 1.0 Session 11 Slide 6 of 16
  • 7. Object-Oriented Programming Using C# Working with Interfaces • Working with interfaces includes interface declaration and implementation of interface by the classes. • You can declare interfaces using the interface keyword. • Interface statements are public, by default. • You can declare only methods, functions, and properties in interfaces. You cannot declare a variable in interfaces. • Interfaces declare methods, which are implemented by classes. A class can inherit from single class but can implement form multiple interfaces. Ver. 1.0 Session 11 Slide 7 of 16
  • 8. Object-Oriented Programming Using C# Inheriting Interfaces A class or a structure that implements interfaces also implements the base interfaces of the inherited interface. Ver. 1.0 Session 11 Slide 8 of 16
  • 9. Object-Oriented Programming Using C# Demo: Order-Processing System Using Abstract Classes Problem Statement: Furniture and Fittings Company (FFC) manufactures domestic furniture. Customers provide their specifications to the company for the furniture they want. To cope with the received customer’s orders, FFC decides to computerize the order-processing system. The system should accept the values of furniture items, such as a bookshelf and a chair. You need to develop the hierarchy of these items. Ver. 1.0 Session 11 Slide 9 of 16
  • 10. Object-Oriented Programming Using C# Demo: Order-Processing System Using Abstract Classes (Contd.) Solution: To create a console based application for FFC, you need to perform the following tasks: 1. Create a console-based application. 2. Build and execute an application. Ver. 1.0 Session 11 Slide 10 of 16
  • 11. Object-Oriented Programming Using C# Implementing the File Input and Output Operations • The stream is a sequence of bytes traveling from a source to a destination over a communication path. • The two basic streams used are the input and output streams. • An input stream is used for a read operation and an output stream is used for performing a write operation. • The System.IO namespace includes various classes, which are used to perform operations, such as file creation, file deletion, and the read-write operations to files. Ver. 1.0 Session 11 Slide 11 of 16
  • 12. Object-Oriented Programming Using C# FileStream Class • To open an existing file or to create a new file, you need to create an object of type FileStream. • Consider the following syntax for creating the object of type FileStream: FileStream <object name>=new FileStream(<file Name>,<FileMode Enumerator>,<File Access Enumerator>,<FileShare Enumerator>); Ver. 1.0 Session 11 Slide 12 of 16
  • 13. Object-Oriented Programming Using C# FileStream Class (Contd.) • FileMode enumerator defines various methods for opening files. • The FileMode enumerator parameter is specified in many constructors for the FileStream. • The parameters to FileMode checks whether a file is overwritten, created, or opened. • FileAccess enumerator indicates whether you want to read data from the file, write to the file, or perform both the operations. • The members of the FileAccess enumerator are Read, ReadWrite, and Write. Ver. 1.0 Session 11 Slide 13 of 16
  • 14. Object-Oriented Programming Using C# FileStream Class (Contd.) The FileShare enumerator contains constants for controlling the kind of access that the other FileStream constructors can have to the same file. A typical use of this enumeration is to define whether two different applications can simultaneously read from the same file. Ver. 1.0 Session 11 Slide 14 of 16
  • 15. Object-Oriented Programming Using C# Summary In this session, you learned that: – An abstract superclass is a conceptual class that does not exist in real world but acts as a base from which other classes inherit properties behavior. – A sealed class tells the compiler that the class cannot be extended further. You cannot derive a class from a sealed class. – An interface defines properties, methods, and events. The properties, methods, and events that are defined in the interface are known as the members of the interface. – A stream is an abstraction of a sequence of bytes traveling from a source to a destination over a communication path. Ver. 1.0 Session 11 Slide 15 of 16
  • 16. Object-Oriented Programming Using C# Summary (Contd.) – The two basic streams used are the input and output streams. An input stream is used for a read operation and an output stream is used for performing a write operation. – Most file input/output (I/O) support in the .NET Framework is implemented in the System.IO namespace. You can use the FileStream class in the System.IO namespace to read from, to write, and to close files. – The FileStream class inherits from the abstract class Stream. Ver. 1.0 Session 11 Slide 16 of 16

Notas del editor

  1. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  2. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  3. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  4. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  5. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  6. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  7. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  8. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  9. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  10. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  11. Students know the importance of surrogate keys. In this session students will learn the strategy to generate the surrogate key. Give an example to explain the strategy to generate the surrogate keys by concatenating the primary key of the source table with the date stamp. For example, data from a Product table has to be loaded into the Product_Dim dimension table on Feb 09, 2006. The product_code is the primary key column in the Product table. To insert the surrogate key values before loading the data into the dimension table, you can combine the primary key value with the date on which the data has to be loaded. In this case the surrogate key value can be product_code+09022006.
  12. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  13. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  14. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  15. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  16. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.