SlideShare a Scribd company logo
1 of 41
Introduction to OOP
Object Oriented Programming Copyright © 2012 IM
Group. All rights
reserved
Agenda
• Small Revision
• Structures
• Classes
Copyright © 2012 IM
Group. All rights
reserved
Topics you Should Understood WELL
• Pointers
• Functions
• Call by value
• Call by reference
• Character array
Copyright © 2012 IM
Group. All rights
reserved
Fast Training
• Make a program that takes a character array as
input
• Append this character array to itself
• Output it
• Example:
▫ Input: Mohammad
▫ Output: MohammadMohammad
• Note:
▫ You must save it in a character array NOT string
Copyright © 2012 IM
Group. All rights
reserved
What Is a Class
• A class is a data type whose variables are objects
• Some pre-defined classes you have used are
▫ int
▫ char
▫ string
• You can define your own classes as well
Copyright © 2012 IM
Group. All rights
reserved
Class Definitions
• A class definition includes
▫ Variables
▫ Functions
• We will start by defining structures as a first step
toward defining classes
Copyright © 2012 IM
Group. All rights
reserved
Structures
Copyright © 2012 IM
Group. All rights
reserved
Structures
• A structure can be viewed as an object:
▫ Contains no functions
▫ Contains multiple values of possibly different
types
• Example: A Student has the following values:
▫ A Name
▫ A GPA
▫ An ID
Copyright © 2012 IM
Group. All rights
reserved
The Student Definition
• The Student structure can be defined as
Copyright © 2012 IM
Group. All rights
reserved
Using the Structure
• Structure definition is generally placed outside
any function definition:
▫ This makes the structure type available to all code
that follows the structure definition
• To declare two variables of type Student:
• Student Salah, Moaaz;
• Salah and Moaaz contain member variables
name, GPA, and ID
Copyright © 2012 IM
Group. All rights
reserved
Access the Variables of a Structure
• To access variables in a structure we should use
the dot Operator “.”
Copyright © 2012 IM
Group. All rights
reserved
Duplication
• You can duplicate the same name in different
structures.
Copyright © 2012 IM
Group. All rights
reserved
Structures as Return Types
• Structures can be the type of a value returned by
a function
• Example:
Copyright © 2012 IM
Group. All rights
reserved
Using Function initialize
• initialize builds a complete structure value in
temp, which is returned by the function
• We can use initialize to give a variable of type
Student a value in this way:
Copyright © 2012 IM
Group. All rights
reserved
Assignment and Structures
• The assignment operator can be used to assign
values to structure types
Copyright © 2012 IM
Group. All rights
reserved
Hierarchical Structures
• Structures can contain member variables that
are also structures
• Note the sequence.
Copyright © 2012 IM
Group. All rights
reserved
Using Student
• A variable of type Student is declared by
▫ Student student1;
• To display the birth year of student1, first access
the birthday member of student1
▫ cout << student1.birthday…
• But we want the year, so we now specify the year
member of the birthday member
▫ cout << student1.birthday.year;
Copyright © 2012 IM
Group. All rights
reserved
Initializing Structures
• A structure can be initialized when declared
• Example:
Copyright © 2012 IM
Group. All rights
reserved
Classes
Copyright © 2012 IM
Group. All rights
reserved
3 Important Topics
Copyright © 2012 IM
Group. All rights
reserved
OOP
Encapsulation PolymorphismInheritance
Classes
• A class description is somewhat like a structure
definition plus the member variables
• To create a new type named DayOfYear as a
class definition
▫ This example’s values are dates such as July 4
using an integer for the number of the month
 Member variable month is an int (Jan = 1, Feb = 2,
etc.)
 Member variable day is an int
▫ Decide on the member functions needed
▫ We use just one member function named output
Copyright © 2012 IM
Group. All rights
reserved
Class DayOfYear Definition
Copyright © 2012 IM
Group. All rights
reserved
Training
• Declare class “Calculator”
Copyright © 2012 IM
Group. All rights
reserved
Defining a Member Function
• There are 2 ways to declare a member function:
▫ Member functions are declared inside the class
declaration
Copyright © 2012 IM
Group. All rights
reserved
Defining a Member Function (cont.)
• Member functions are declared outside the class
declaration
• To declare a function outside the class
declaration you should know the scope operator
“::”
Copyright © 2012 IM
Group. All rights
reserved
The Scope Operator “::”
• Tells the class a member function is a member of
• void DayOfYear::output() indicates that function
output is a member of the DayOfYear class
Copyright © 2012 IM
Group. All rights
reserved
Training
• Define the function of class “Calculator” with the
scope operator
Copyright © 2012 IM
Group. All rights
reserved
Encapsulation
• Encapsulation is
▫ Combining a number of items, such as variables
and functions, into a single package such as an
object of a class
Copyright © 2012 IM
Group. All rights
reserved
Public Or Private
• C++ helps us restrict the program from directly
referencing member variables
• Private members of a class can only be
referenced within the definitions of member
functions
• If the program tries to access a private member,
the compiler gives an error message
• Private members can be variables or functions
Copyright © 2012 IM
Group. All rights
reserved
General Class Definitions
• The syntax for a class definition is:
Copyright © 2012 IM
Group. All rights
reserved
The Assignment Operator “=“
• Objects and structures can be assigned values
with the assignment operator (=)
• Example:
Copyright © 2012 IM
Group. All rights
reserved
Calling Public & Private Members
• Public:
▫ Fell free to call the public functions or variables in
any part of your code
▫ You must use an object to call it
• Private:
▫ Call it only in a public function
▫ Call it without objects
Copyright © 2012 IM
Group. All rights
reserved
Access private variables
• What you will do if you want to read or edit a
private variable ?!!
• Use Setter & Getter function
• Let’s see the new class
Copyright © 2012 IM
Group. All rights
reserved
Class DayOfYear
Copyright © 2012 IM
Group. All rights
reserved
Training
• Rearrange class “Calculator” with public &
private sectors
Copyright © 2012 IM
Group. All rights
reserved
Constructors
• A constructor can be used to initialize member
variables when an object is declared
• A constructor is a member function that is usually
public
• A constructor is automatically called when an object
of the class is declared
• A constructor’s name must be the name of the class
• A constructor cannot return a value
• No return type, not even void, is used in declaring or
defining a constructor
Copyright © 2012 IM
Group. All rights
reserved
Default Constructor
Copyright © 2012 IM
Group. All rights
reserved
• Calling it: DayOfYear today;
Parameterized Constructor
• Calling it: DayOfYear today(1, 7);
Copyright © 2012 IM
Group. All rights
reserved
Initialization Section
• You can declare the constructor like this:
Copyright © 2012 IM
Group. All rights
reserved
Training
• Make constructors in your class “Calculator”
Copyright © 2012 IM
Group. All rights
reserved
Any Questions
Session 1 Copyright © 2012 IM
Group. All rights
reserved

More Related Content

What's hot

CSCI 238 Chapter 07 - Classes
CSCI 238 Chapter 07 - ClassesCSCI 238 Chapter 07 - Classes
CSCI 238 Chapter 07 - Classes
DanWooster1
 
Object-Oriented Concepts
Object-Oriented ConceptsObject-Oriented Concepts
Object-Oriented Concepts
Abdalla Mahmoud
 

What's hot (8)

Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
 
Chap5java5th
Chap5java5thChap5java5th
Chap5java5th
 
CSCI 238 Chapter 07 - Classes
CSCI 238 Chapter 07 - ClassesCSCI 238 Chapter 07 - Classes
CSCI 238 Chapter 07 - Classes
 
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Object-Oriented Concepts
Object-Oriented ConceptsObject-Oriented Concepts
Object-Oriented Concepts
 

Similar to OOP - Introduction

Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
Vu Tran Lam
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
Connex
 

Similar to OOP - Introduction (20)

OOP - Friend Functions
OOP - Friend FunctionsOOP - Friend Functions
OOP - Friend Functions
 
Introduction to C++ Class & Objects. Book Notes
Introduction to C++ Class & Objects. Book NotesIntroduction to C++ Class & Objects. Book Notes
Introduction to C++ Class & Objects. Book Notes
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
1_Object Oriented Programming.pptx
1_Object Oriented Programming.pptx1_Object Oriented Programming.pptx
1_Object Oriented Programming.pptx
 
Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
 
AngularJS
AngularJSAngularJS
AngularJS
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
 
oop 3.pptx
oop 3.pptxoop 3.pptx
oop 3.pptx
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
 
Presentation 4th
Presentation 4thPresentation 4th
Presentation 4th
 
07slide.ppt
07slide.ppt07slide.ppt
07slide.ppt
 
Joomla Modules with Permissions and Front-End Editing
Joomla Modules with Permissions and Front-End EditingJoomla Modules with Permissions and Front-End Editing
Joomla Modules with Permissions and Front-End Editing
 
Angular4 kickstart
Angular4 kickstartAngular4 kickstart
Angular4 kickstart
 
Core java
Core javaCore java
Core java
 
Core java
Core javaCore java
Core java
 
Lec08 constructors
Lec08   constructorsLec08   constructors
Lec08 constructors
 
Implementing Domain-Driven Design study group - ch. 5 entities
Implementing Domain-Driven Design study group - ch. 5 entitiesImplementing Domain-Driven Design study group - ch. 5 entities
Implementing Domain-Driven Design study group - ch. 5 entities
 
Ng Sydney Dynamic Templates Talk - 18 April 2018
Ng Sydney Dynamic Templates Talk - 18 April 2018Ng Sydney Dynamic Templates Talk - 18 April 2018
Ng Sydney Dynamic Templates Talk - 18 April 2018
 

More from Mohammad Shaker (8)

Android Development - Session 5
Android Development - Session 5Android Development - Session 5
Android Development - Session 5
 
Android Development - Session 4
Android Development - Session 4Android Development - Session 4
Android Development - Session 4
 
Android Development - Session 2
Android Development - Session 2Android Development - Session 2
Android Development - Session 2
 
Android Development - Session 1
Android Development - Session 1Android Development - Session 1
Android Development - Session 1
 
Introduction to Qt
Introduction to QtIntroduction to Qt
Introduction to Qt
 
OOP - STL
OOP - STLOOP - STL
OOP - STL
 
NoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to CouchbaseNoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to Couchbase
 
Introduction to Couchbase
Introduction to CouchbaseIntroduction to Couchbase
Introduction to Couchbase
 

Recently uploaded

Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Lisi Hocke
 

Recently uploaded (20)

Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
 
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
Abortion Pill Prices Jane Furse ](+27832195400*)[ 🏥 Women's Abortion Clinic i...
 
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptxFrom Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
 
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
 
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with Links
 
Encryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key ConceptsEncryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key Concepts
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdf
 
Your Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | EvmuxYour Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | Evmux
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with GraphGraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
GraphSummit Milan & Stockholm - Neo4j: The Art of the Possible with Graph
 

OOP - Introduction

  • 1. Introduction to OOP Object Oriented Programming Copyright © 2012 IM Group. All rights reserved
  • 2. Agenda • Small Revision • Structures • Classes Copyright © 2012 IM Group. All rights reserved
  • 3. Topics you Should Understood WELL • Pointers • Functions • Call by value • Call by reference • Character array Copyright © 2012 IM Group. All rights reserved
  • 4. Fast Training • Make a program that takes a character array as input • Append this character array to itself • Output it • Example: ▫ Input: Mohammad ▫ Output: MohammadMohammad • Note: ▫ You must save it in a character array NOT string Copyright © 2012 IM Group. All rights reserved
  • 5. What Is a Class • A class is a data type whose variables are objects • Some pre-defined classes you have used are ▫ int ▫ char ▫ string • You can define your own classes as well Copyright © 2012 IM Group. All rights reserved
  • 6. Class Definitions • A class definition includes ▫ Variables ▫ Functions • We will start by defining structures as a first step toward defining classes Copyright © 2012 IM Group. All rights reserved
  • 7. Structures Copyright © 2012 IM Group. All rights reserved
  • 8. Structures • A structure can be viewed as an object: ▫ Contains no functions ▫ Contains multiple values of possibly different types • Example: A Student has the following values: ▫ A Name ▫ A GPA ▫ An ID Copyright © 2012 IM Group. All rights reserved
  • 9. The Student Definition • The Student structure can be defined as Copyright © 2012 IM Group. All rights reserved
  • 10. Using the Structure • Structure definition is generally placed outside any function definition: ▫ This makes the structure type available to all code that follows the structure definition • To declare two variables of type Student: • Student Salah, Moaaz; • Salah and Moaaz contain member variables name, GPA, and ID Copyright © 2012 IM Group. All rights reserved
  • 11. Access the Variables of a Structure • To access variables in a structure we should use the dot Operator “.” Copyright © 2012 IM Group. All rights reserved
  • 12. Duplication • You can duplicate the same name in different structures. Copyright © 2012 IM Group. All rights reserved
  • 13. Structures as Return Types • Structures can be the type of a value returned by a function • Example: Copyright © 2012 IM Group. All rights reserved
  • 14. Using Function initialize • initialize builds a complete structure value in temp, which is returned by the function • We can use initialize to give a variable of type Student a value in this way: Copyright © 2012 IM Group. All rights reserved
  • 15. Assignment and Structures • The assignment operator can be used to assign values to structure types Copyright © 2012 IM Group. All rights reserved
  • 16. Hierarchical Structures • Structures can contain member variables that are also structures • Note the sequence. Copyright © 2012 IM Group. All rights reserved
  • 17. Using Student • A variable of type Student is declared by ▫ Student student1; • To display the birth year of student1, first access the birthday member of student1 ▫ cout << student1.birthday… • But we want the year, so we now specify the year member of the birthday member ▫ cout << student1.birthday.year; Copyright © 2012 IM Group. All rights reserved
  • 18. Initializing Structures • A structure can be initialized when declared • Example: Copyright © 2012 IM Group. All rights reserved
  • 19. Classes Copyright © 2012 IM Group. All rights reserved
  • 20. 3 Important Topics Copyright © 2012 IM Group. All rights reserved OOP Encapsulation PolymorphismInheritance
  • 21. Classes • A class description is somewhat like a structure definition plus the member variables • To create a new type named DayOfYear as a class definition ▫ This example’s values are dates such as July 4 using an integer for the number of the month  Member variable month is an int (Jan = 1, Feb = 2, etc.)  Member variable day is an int ▫ Decide on the member functions needed ▫ We use just one member function named output Copyright © 2012 IM Group. All rights reserved
  • 22. Class DayOfYear Definition Copyright © 2012 IM Group. All rights reserved
  • 23. Training • Declare class “Calculator” Copyright © 2012 IM Group. All rights reserved
  • 24. Defining a Member Function • There are 2 ways to declare a member function: ▫ Member functions are declared inside the class declaration Copyright © 2012 IM Group. All rights reserved
  • 25. Defining a Member Function (cont.) • Member functions are declared outside the class declaration • To declare a function outside the class declaration you should know the scope operator “::” Copyright © 2012 IM Group. All rights reserved
  • 26. The Scope Operator “::” • Tells the class a member function is a member of • void DayOfYear::output() indicates that function output is a member of the DayOfYear class Copyright © 2012 IM Group. All rights reserved
  • 27. Training • Define the function of class “Calculator” with the scope operator Copyright © 2012 IM Group. All rights reserved
  • 28. Encapsulation • Encapsulation is ▫ Combining a number of items, such as variables and functions, into a single package such as an object of a class Copyright © 2012 IM Group. All rights reserved
  • 29. Public Or Private • C++ helps us restrict the program from directly referencing member variables • Private members of a class can only be referenced within the definitions of member functions • If the program tries to access a private member, the compiler gives an error message • Private members can be variables or functions Copyright © 2012 IM Group. All rights reserved
  • 30. General Class Definitions • The syntax for a class definition is: Copyright © 2012 IM Group. All rights reserved
  • 31. The Assignment Operator “=“ • Objects and structures can be assigned values with the assignment operator (=) • Example: Copyright © 2012 IM Group. All rights reserved
  • 32. Calling Public & Private Members • Public: ▫ Fell free to call the public functions or variables in any part of your code ▫ You must use an object to call it • Private: ▫ Call it only in a public function ▫ Call it without objects Copyright © 2012 IM Group. All rights reserved
  • 33. Access private variables • What you will do if you want to read or edit a private variable ?!! • Use Setter & Getter function • Let’s see the new class Copyright © 2012 IM Group. All rights reserved
  • 34. Class DayOfYear Copyright © 2012 IM Group. All rights reserved
  • 35. Training • Rearrange class “Calculator” with public & private sectors Copyright © 2012 IM Group. All rights reserved
  • 36. Constructors • A constructor can be used to initialize member variables when an object is declared • A constructor is a member function that is usually public • A constructor is automatically called when an object of the class is declared • A constructor’s name must be the name of the class • A constructor cannot return a value • No return type, not even void, is used in declaring or defining a constructor Copyright © 2012 IM Group. All rights reserved
  • 37. Default Constructor Copyright © 2012 IM Group. All rights reserved • Calling it: DayOfYear today;
  • 38. Parameterized Constructor • Calling it: DayOfYear today(1, 7); Copyright © 2012 IM Group. All rights reserved
  • 39. Initialization Section • You can declare the constructor like this: Copyright © 2012 IM Group. All rights reserved
  • 40. Training • Make constructors in your class “Calculator” Copyright © 2012 IM Group. All rights reserved
  • 41. Any Questions Session 1 Copyright © 2012 IM Group. All rights reserved