SlideShare a Scribd company logo
Object-Oriented Programming Using C#
Objectives


               In this session, you will learn to:
                  Implement operator overloading
                  Identify relationships between classes
                  Use classes and inheritance




    Ver. 1.0                        Session 10             Slide 1 of 21
Object-Oriented Programming Using C#
Overloading Unary Operators


               Unary operators act on a single operand. Some examples
               of unary operators are the increment (++) and decrement
               (--) operators.
               Unary operators can be classified as:
                  Simple prefix unary operators, for example the – (minus)
                  operator.
                  Pre and post increment and decrement operators, for example
                  the ++() prefix increment operator.
               The implementation of the increment operator used with
               structs cannot be implemented with classes.




    Ver. 1.0                      Session 10                          Slide 2 of 21
Object-Oriented Programming Using C#
Overloading Binary Operators


               Binary operators are operators that work with two operands.
               Binary operators include the arithmetic operators (+, -, *, /,
               %), arithmetic assignment operators (+=, -=, *=, /=. %=),
               and comparison operators (<, >, <=, >=, ==, !=).
               Overloading a binary operator is similar to overloading a
               unary operator, except that a binary operator requires an
               additional parameter.
               Following is the syntax of binary overloading in C#:
                operator <operator>(Object1,Object2);




    Ver. 1.0                      Session 10                         Slide 3 of 21
Object-Oriented Programming Using C#
Demo: Overloading an Operator


               Problem Statement:
                  FunCity Land is a newly established amusement park located
                  in West Virginia. Brad is a chief technical officer of FunCity
                  Land. He is currently working on a project related with
                  calculating distances. This project will calculate the distance to
                  reach FunCity Land from various locations because many
                  visitors do not know the exact location of the park.
                  Brad needs to develop a program, which would enter a visitor’s
                  location and the distance traveled by the visitor till that point.
                  After analyzing the location and the distance traveled by the
                  visitor, the program should display the remaining distance and
                  the total distance traveled.
                  Help Brad to develop an application by overloading the binary
                  operator(+).



    Ver. 1.0                        Session 10                             Slide 4 of 21
Object-Oriented Programming Using C#
Demo: Overloading an Operator (Contd.)


               Solution:
                  To develop the required application, Brad needs to perform the
                  following tasks:
                   1. Create a console-based application.
                   2. Build and execute an application.




    Ver. 1.0                        Session 10                          Slide 5 of 21
Object-Oriented Programming Using C#
Identifying Relationships Between Classes


               In software application, classes and objects are related to
               each other.
               In the object-oriented approach, objects perform actions in
               response to messages from other objects defining the
               recipient object’s behavior.
               This approach specifies the relationships among classes
               based on the behavior of individual class.




    Ver. 1.0                      Session 10                        Slide 6 of 21
Object-Oriented Programming Using C#
Kinds of Relationships


               There are various relationships between objects of different
               classes in an object-oriented environment:
                  Inheritance Relationship:
                      Object-oriented programming enables classes to inherit commonly
                      used state and behavior from other classes.
                      In C# programming, a class is allowed to inherit from another
                      class.
                      Generalization is needed to create programs that can be
                      customized in accordance with new requirements.
               Let us understand the concept of inheritance relationship
               with the help of an example.




    Ver. 1.0                        Session 10                              Slide 7 of 21
Object-Oriented Programming Using C#
Kinds of Relationships (Contd.)


                         Parent Class




    Ver. 1.0                  Session 10   Slide 8 of 21
Object-Oriented Programming Using C#
Kinds of Relationships (Contd.)



                                          Parent Class




                                           Child Class




    Ver. 1.0                 Session 10                  Slide 9 of 21
Object-Oriented Programming Using C#
Kinds of Relationships (Contd.)


                                          Parent Class




                                          Child Class
                                          Deriving the features of parents,
                                          such as height, complexion, and
                                          Behavior


    Ver. 1.0                 Session 10                           Slide 10 of 21
Object-Oriented Programming Using C#
Kinds of Relationships (Contd.)


               You can also establish a relationship between a superclass
               and its subclasses.
               The following figure shows the hierarchy of the subclasses
               of a superclass.
                                      Automobile




                                Car                 Bus




                         Ford    BMW           Toyota     Mitsubishi




    Ver. 1.0                           Session 10                      Slide 11 of 21
Object-Oriented Programming Using C#
Kinds of Relationships (Contd.)


               • Composition Relationship:
                     Object-oriented programming allows you to form an object,
                     which includes another object as its part. This mechanism of
                     forming an object is called composition.
               • Utilization Relationship:
                     Object-oriented programming allows a class to make use of
                     another class. This kind of relationship is called utilization.
               • Instantiation Relationship:
                     Object-oriented programming allows a relationship between a
                     class and an instance of that class. This kind of relationship is
                     called instantiation.




    Ver. 1.0                           Session 10                              Slide 12 of 21
Object-Oriented Programming Using C#
Just a minute


               Build the hierarchy of the mixer, VCR, color television,
               washing machine, stereo class objects, and generalize
               wherever possible.


               Answer:
                  The figure shows the hierarchy of the class objects.

                                                         Electronic Items




                         Entertainment Items                                    Utility Items




                    Color             VCR           Stereo                               Washing
                                                                        Mixer
                    Television                                                           Machine




    Ver. 1.0                                   Session 10                                          Slide 13 of 21
Object-Oriented Programming Using C#
Just a minute


               Identify the relationship between the following class pairs:
                1.   Television – Speaker
                2.   Mammal – Tiger
                3.   Garment – Shirt
                4.   Cup – Tea
                5.   Computer – Microprocessor


               Answer:
                     5 and 1 are examples of composition relationships.
                     3 and 2 are examples of inheritance relationships.
                     4 does not exhibit any relationship. Tea is not an attribute of
                     cup.




    Ver. 1.0                          Session 10                              Slide 14 of 21
Object-Oriented Programming Using C#
Just a minute


               Identify the classes and their utilization relationship in the
               following scenario of a departmental store.
               There are several counters and each counter in the store is
               manned by a single salesperson who sells a specific
               product. A customer approaches a counter. Depending on
               the customer’s desire to purchase a product, the
               salesperson sells the product to the customer and accepts
               payment.

               Answer:
                  The utilization relationship of the preceding scenario are:
                      Salespersons man the counters.
                      Each counter deals in a specific product.
                      The customer buys a product.
                      The customer pays the salesperson.


    Ver. 1.0                         Session 10                            Slide 15 of 21
Object-Oriented Programming Using C#
Using Classes and Inheritance


               In C#, inheritance is the property by which the objects of a
               derived class possess copies of the data members and the
               member functions of the base class.
               A class that inherits or derives attributes from another class
               is called the derived class.
               The class from which attributes are derived is called the
               base class.
               In object-oriented programming, the base class is actually a
               superclass and the derived class is a subclass.




    Ver. 1.0                       Session 10                        Slide 16 of 21
Object-Oriented Programming Using C#
Implementing Inheritance


               Each instance of the derived class includes the attributes of
               the base class.
               Any change made to the base class automatically changes
               the behavior of its derived classes.
               The syntax used in C# for creating derived classes is as
               follows:
                  <access-specifier> class <base_class>
                  {
                      ...
                  }
                      class <derived_class> : <base_class>
                  {
                      ...
                  }

    Ver. 1.0                      Session 10                         Slide 17 of 21
Object-Oriented Programming Using C#
Implementing Inheritance (Contd.)


               You can use the following thumb rule to establish whether
               inheritance is required while you are designing a program.
               Always check the kind of relationship between the derived
               and the base class.
                  Ensure that the derived class can base class.
                  You can also use inherited classes with constructors.
                  In inheritance, the derived class receives the base class
                  member variables and methods. This means that an order of
                  inheritance must be followed during the construction of an
                  object.




    Ver. 1.0                      Session 10                          Slide 18 of 21
Object-Oriented Programming Using C#
Summary


              In this session, you learned that:
                 Operators may be classified as unary and binary operators.
                 Unary operators work with one operand and are classified as:
                  •   Simple prefix unary operators
                  •   Pre and post increment and decrement operators
               – A prefix unary operator may be defined by a member function
                 that takes no parameters or by a nonmember function that
                 takes one parameter.
               – Binary operators work with two operands.
               – Overloading a binary operator is similar to overloading a unary
                 operator, except that a binary operator requires an additional
                 parameter.




   Ver. 1.0                         Session 10                          Slide 19 of 21
Object-Oriented Programming Using C#
Summary (Contd.)


                 The four kinds of relationships that exist among classes are:
                  •   Inheritance relationship
                  •   Composition relationship
                  •   Utilization relationship
                  •   Instantiation relationship
               – Object-oriented programming enables classes to inherit
                 commonly used state and behavior from other classes.
               – Generalization means that multiple classes can inherit from the
                 same superclass.
               – The composition relationship exists when one class is made up
                 of another class.
               – The utilization relationship exists between two or more
                 unrelated classes if one class uses the other.




    Ver. 1.0                          Session 10                        Slide 20 of 21
Object-Oriented Programming Using C#
Summary (Contd.)


               An instantiation relationship is a relationship between a class
               and an instance of that class.
               A class that inherits or derives attributes from another class is
               called the derived class and the class from which it is derived
               is called the base class.
               Inheritance avoids redundancy in code and enables easy
               maintenance of code.
               Constructors are called in the order of base-to-derived.




    Ver. 1.0                     Session 10                             Slide 21 of 21

More Related Content

PPS
10 iec t1_s1_oo_ps_session_14
PPS
04 iec t1_s1_oo_ps_session_05
PPS
06 iec t1_s1_oo_ps_session_08
PPS
12 iec t1_s1_oo_ps_session_17
PPS
05 iec t1_s1_oo_ps_session_07
PPS
11 iec t1_s1_oo_ps_session_16
PPS
08 iec t1_s1_oo_ps_session_11
PPS
01 iec t1_s1_oo_ps_session_01
10 iec t1_s1_oo_ps_session_14
04 iec t1_s1_oo_ps_session_05
06 iec t1_s1_oo_ps_session_08
12 iec t1_s1_oo_ps_session_17
05 iec t1_s1_oo_ps_session_07
11 iec t1_s1_oo_ps_session_16
08 iec t1_s1_oo_ps_session_11
01 iec t1_s1_oo_ps_session_01

What's hot (20)

PPS
09 iec t1_s1_oo_ps_session_13
PPS
13 iec t1_s1_oo_ps_session_19
PPS
03 iec t1_s1_oo_ps_session_04
PPS
01 gui 01
PPS
Java session02
PPS
Java session01
PPS
02 iec t1_s1_plt_session_02
PPS
Java session11
PPS
Dacj 1-3 c
PDF
Write native iPhone applications using Eclipse CDT
PPS
Dacj 1-2 a
PPT
C Course Material0209
PDF
Oop02 6
PDF
Oop04 6
PPT
4.class diagramsusinguml
 
PDF
Fudcon D programming
PPT
Csharp
PDF
Win32/Flamer: Reverse Engineering and Framework Reconstruction
PPTX
Evolution of Patterns
09 iec t1_s1_oo_ps_session_13
13 iec t1_s1_oo_ps_session_19
03 iec t1_s1_oo_ps_session_04
01 gui 01
Java session02
Java session01
02 iec t1_s1_plt_session_02
Java session11
Dacj 1-3 c
Write native iPhone applications using Eclipse CDT
Dacj 1-2 a
C Course Material0209
Oop02 6
Oop04 6
4.class diagramsusinguml
 
Fudcon D programming
Csharp
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Evolution of Patterns
Ad

Viewers also liked (6)

PPTX
Threading
PPTX
PDF
C# Advanced L04-Threading
PPT
Threads c sharp
PDF
C# Delegates and Event Handling
PDF
Threading in c#
Threading
C# Advanced L04-Threading
Threads c sharp
C# Delegates and Event Handling
Threading in c#
Ad

Similar to 07 iec t1_s1_oo_ps_session_10 (20)

PDF
Intro to c# (vs. objective c and java)
PDF
Intro to c# (vs. objective c and java)
PPT
Programming with c#
PPT
Programming in c#
PDF
Reuse Contracts
PDF
Java Programming
PPT
Object Oriented Software Development, using c# programming language
DOCX
Answer all questions and discussions.1.Describe what is an.docx
PPTX
Sofwear deasign and need of design pattern
PPSX
Prophecy Of Design Patterns
PDF
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
DOC
Csharp
PPTX
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
PDF
IOSR Journals
DOCX
HSc Computer Science Practical Slip for Class 12
PPTX
DOCX
Uday Resume
PDF
CS305PC_C++_UNIT 1 notes jntuh third semester
DOCX
Bca2030 object oriented programming – c++
PPTX
PATTERNS01 - An Introduction to Design Patterns
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)
Programming with c#
Programming in c#
Reuse Contracts
Java Programming
Object Oriented Software Development, using c# programming language
Answer all questions and discussions.1.Describe what is an.docx
Sofwear deasign and need of design pattern
Prophecy Of Design Patterns
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
Csharp
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
IOSR Journals
HSc Computer Science Practical Slip for Class 12
Uday Resume
CS305PC_C++_UNIT 1 notes jntuh third semester
Bca2030 object oriented programming – c++
PATTERNS01 - An Introduction to Design Patterns

More from Niit Care (20)

PPS
Ajs 1 b
PPS
Ajs 4 b
PPS
Ajs 4 a
PPS
Ajs 4 c
PPS
Ajs 3 b
PPS
Ajs 3 a
PPS
Ajs 3 c
PPS
Ajs 2 b
PPS
Ajs 2 a
PPS
Ajs 2 c
PPS
Ajs 1 a
PPS
Ajs 1 c
PPS
Dacj 4 2-c
PPS
Dacj 4 2-b
PPS
Dacj 4 2-a
PPS
Dacj 4 1-c
PPS
Dacj 4 1-b
PPS
Dacj 4 1-a
PPS
Dacj 1-2 b
PPS
Dacj 1-3 b
Ajs 1 b
Ajs 4 b
Ajs 4 a
Ajs 4 c
Ajs 3 b
Ajs 3 a
Ajs 3 c
Ajs 2 b
Ajs 2 a
Ajs 2 c
Ajs 1 a
Ajs 1 c
Dacj 4 2-c
Dacj 4 2-b
Dacj 4 2-a
Dacj 4 1-c
Dacj 4 1-b
Dacj 4 1-a
Dacj 1-2 b
Dacj 1-3 b

Recently uploaded (20)

PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Hybrid model detection and classification of lung cancer
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
1. Introduction to Computer Programming.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Encapsulation theory and applications.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Getting Started with Data Integration: FME Form 101
Heart disease approach using modified random forest and particle swarm optimi...
A comparative study of natural language inference in Swahili using monolingua...
SOPHOS-XG Firewall Administrator PPT.pptx
DP Operators-handbook-extract for the Mautical Institute
1 - Historical Antecedents, Social Consideration.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Tartificialntelligence_presentation.pptx
NewMind AI Weekly Chronicles - August'25-Week II
Hybrid model detection and classification of lung cancer
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
1. Introduction to Computer Programming.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Chapter 5: Probability Theory and Statistics
Encapsulation theory and applications.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Web App vs Mobile App What Should You Build First.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Enhancing emotion recognition model for a student engagement use case through...
Getting Started with Data Integration: FME Form 101

07 iec t1_s1_oo_ps_session_10

  • 1. Object-Oriented Programming Using C# Objectives In this session, you will learn to: Implement operator overloading Identify relationships between classes Use classes and inheritance Ver. 1.0 Session 10 Slide 1 of 21
  • 2. Object-Oriented Programming Using C# Overloading Unary Operators Unary operators act on a single operand. Some examples of unary operators are the increment (++) and decrement (--) operators. Unary operators can be classified as: Simple prefix unary operators, for example the – (minus) operator. Pre and post increment and decrement operators, for example the ++() prefix increment operator. The implementation of the increment operator used with structs cannot be implemented with classes. Ver. 1.0 Session 10 Slide 2 of 21
  • 3. Object-Oriented Programming Using C# Overloading Binary Operators Binary operators are operators that work with two operands. Binary operators include the arithmetic operators (+, -, *, /, %), arithmetic assignment operators (+=, -=, *=, /=. %=), and comparison operators (<, >, <=, >=, ==, !=). Overloading a binary operator is similar to overloading a unary operator, except that a binary operator requires an additional parameter. Following is the syntax of binary overloading in C#: operator <operator>(Object1,Object2); Ver. 1.0 Session 10 Slide 3 of 21
  • 4. Object-Oriented Programming Using C# Demo: Overloading an Operator Problem Statement: FunCity Land is a newly established amusement park located in West Virginia. Brad is a chief technical officer of FunCity Land. He is currently working on a project related with calculating distances. This project will calculate the distance to reach FunCity Land from various locations because many visitors do not know the exact location of the park. Brad needs to develop a program, which would enter a visitor’s location and the distance traveled by the visitor till that point. After analyzing the location and the distance traveled by the visitor, the program should display the remaining distance and the total distance traveled. Help Brad to develop an application by overloading the binary operator(+). Ver. 1.0 Session 10 Slide 4 of 21
  • 5. Object-Oriented Programming Using C# Demo: Overloading an Operator (Contd.) Solution: To develop the required application, Brad needs to perform the following tasks: 1. Create a console-based application. 2. Build and execute an application. Ver. 1.0 Session 10 Slide 5 of 21
  • 6. Object-Oriented Programming Using C# Identifying Relationships Between Classes In software application, classes and objects are related to each other. In the object-oriented approach, objects perform actions in response to messages from other objects defining the recipient object’s behavior. This approach specifies the relationships among classes based on the behavior of individual class. Ver. 1.0 Session 10 Slide 6 of 21
  • 7. Object-Oriented Programming Using C# Kinds of Relationships There are various relationships between objects of different classes in an object-oriented environment: Inheritance Relationship: Object-oriented programming enables classes to inherit commonly used state and behavior from other classes. In C# programming, a class is allowed to inherit from another class. Generalization is needed to create programs that can be customized in accordance with new requirements. Let us understand the concept of inheritance relationship with the help of an example. Ver. 1.0 Session 10 Slide 7 of 21
  • 8. Object-Oriented Programming Using C# Kinds of Relationships (Contd.) Parent Class Ver. 1.0 Session 10 Slide 8 of 21
  • 9. Object-Oriented Programming Using C# Kinds of Relationships (Contd.) Parent Class Child Class Ver. 1.0 Session 10 Slide 9 of 21
  • 10. Object-Oriented Programming Using C# Kinds of Relationships (Contd.) Parent Class Child Class Deriving the features of parents, such as height, complexion, and Behavior Ver. 1.0 Session 10 Slide 10 of 21
  • 11. Object-Oriented Programming Using C# Kinds of Relationships (Contd.) You can also establish a relationship between a superclass and its subclasses. The following figure shows the hierarchy of the subclasses of a superclass. Automobile Car Bus Ford BMW Toyota Mitsubishi Ver. 1.0 Session 10 Slide 11 of 21
  • 12. Object-Oriented Programming Using C# Kinds of Relationships (Contd.) • Composition Relationship: Object-oriented programming allows you to form an object, which includes another object as its part. This mechanism of forming an object is called composition. • Utilization Relationship: Object-oriented programming allows a class to make use of another class. This kind of relationship is called utilization. • Instantiation Relationship: Object-oriented programming allows a relationship between a class and an instance of that class. This kind of relationship is called instantiation. Ver. 1.0 Session 10 Slide 12 of 21
  • 13. Object-Oriented Programming Using C# Just a minute Build the hierarchy of the mixer, VCR, color television, washing machine, stereo class objects, and generalize wherever possible. Answer: The figure shows the hierarchy of the class objects. Electronic Items Entertainment Items Utility Items Color VCR Stereo Washing Mixer Television Machine Ver. 1.0 Session 10 Slide 13 of 21
  • 14. Object-Oriented Programming Using C# Just a minute Identify the relationship between the following class pairs: 1. Television – Speaker 2. Mammal – Tiger 3. Garment – Shirt 4. Cup – Tea 5. Computer – Microprocessor Answer: 5 and 1 are examples of composition relationships. 3 and 2 are examples of inheritance relationships. 4 does not exhibit any relationship. Tea is not an attribute of cup. Ver. 1.0 Session 10 Slide 14 of 21
  • 15. Object-Oriented Programming Using C# Just a minute Identify the classes and their utilization relationship in the following scenario of a departmental store. There are several counters and each counter in the store is manned by a single salesperson who sells a specific product. A customer approaches a counter. Depending on the customer’s desire to purchase a product, the salesperson sells the product to the customer and accepts payment. Answer: The utilization relationship of the preceding scenario are: Salespersons man the counters. Each counter deals in a specific product. The customer buys a product. The customer pays the salesperson. Ver. 1.0 Session 10 Slide 15 of 21
  • 16. Object-Oriented Programming Using C# Using Classes and Inheritance In C#, inheritance is the property by which the objects of a derived class possess copies of the data members and the member functions of the base class. A class that inherits or derives attributes from another class is called the derived class. The class from which attributes are derived is called the base class. In object-oriented programming, the base class is actually a superclass and the derived class is a subclass. Ver. 1.0 Session 10 Slide 16 of 21
  • 17. Object-Oriented Programming Using C# Implementing Inheritance Each instance of the derived class includes the attributes of the base class. Any change made to the base class automatically changes the behavior of its derived classes. The syntax used in C# for creating derived classes is as follows: <access-specifier> class <base_class> { ... } class <derived_class> : <base_class> { ... } Ver. 1.0 Session 10 Slide 17 of 21
  • 18. Object-Oriented Programming Using C# Implementing Inheritance (Contd.) You can use the following thumb rule to establish whether inheritance is required while you are designing a program. Always check the kind of relationship between the derived and the base class. Ensure that the derived class can base class. You can also use inherited classes with constructors. In inheritance, the derived class receives the base class member variables and methods. This means that an order of inheritance must be followed during the construction of an object. Ver. 1.0 Session 10 Slide 18 of 21
  • 19. Object-Oriented Programming Using C# Summary In this session, you learned that: Operators may be classified as unary and binary operators. Unary operators work with one operand and are classified as: • Simple prefix unary operators • Pre and post increment and decrement operators – A prefix unary operator may be defined by a member function that takes no parameters or by a nonmember function that takes one parameter. – Binary operators work with two operands. – Overloading a binary operator is similar to overloading a unary operator, except that a binary operator requires an additional parameter. Ver. 1.0 Session 10 Slide 19 of 21
  • 20. Object-Oriented Programming Using C# Summary (Contd.) The four kinds of relationships that exist among classes are: • Inheritance relationship • Composition relationship • Utilization relationship • Instantiation relationship – Object-oriented programming enables classes to inherit commonly used state and behavior from other classes. – Generalization means that multiple classes can inherit from the same superclass. – The composition relationship exists when one class is made up of another class. – The utilization relationship exists between two or more unrelated classes if one class uses the other. Ver. 1.0 Session 10 Slide 20 of 21
  • 21. Object-Oriented Programming Using C# Summary (Contd.) An instantiation relationship is a relationship between a class and an instance of that class. A class that inherits or derives attributes from another class is called the derived class and the class from which it is derived is called the base class. Inheritance avoids redundancy in code and enables easy maintenance of code. Constructors are called in the order of base-to-derived. Ver. 1.0 Session 10 Slide 21 of 21

Editor's Notes

  • #2: 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.
  • #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: 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.
  • #8: 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.
  • #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.
  • #17: 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.
  • #18: 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.
  • #19: 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.
  • #20: 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.
  • #21: 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.
  • #22: 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.