/
Object-Oriented Paradigm Object-Oriented Paradigm

Object-Oriented Paradigm - PowerPoint Presentation

PriceOfFreedom
PriceOfFreedom . @PriceOfFreedom
Follow
344 views
Uploaded On 2022-08-01

Object-Oriented Paradigm - PPT Presentation

The Concept Bundled together in one object Data Types Functionality Encapsulation State variables used to describe the object Functions dictating how the object interacts and interfaces with other entities ID: 931444

int fraction class void fraction int void class public private numerator print readin denominator const unreduced reciprocal data member

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Object-Oriented Paradigm" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Object-Oriented Paradigm

Slide2

The Concept

Bundled together in one object

Data Types

Functionality

Encapsulation

State variables used to describe the object

Functions dictating how the object interacts and interfaces with other entities

Slide3

Your First Class

class

name_of_type

{

public:

// function prototypes here

private:

// member data here

};

Slide4

Your First Class

class

name_of_type

{

public:

// function prototypes here

private:

// member data here

};

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

Slide5

Your First Class

class

name_of_type

{

public:

// function prototypes here

private:

// member data here

};

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

Slide6

Your First Class

class

name_of_type

{

public:

// function prototypes here

private:

// member data here

};

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

Slide7

Your First Class

class

name_of_type

{

public:

// function prototypes here

private:

// member data here

};

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

Slide8

Your First Class

class

name_of_type

{

public:

// function prototypes here

private:

// member data here

};

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

Slide9

Your First Class

class

name_of_type

{

public:

// function prototypes here

private:

// member data here

};

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

Slide10

Private By Default

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

class Fraction

{

int

m_Numerator

;

int

m_Denominator

;

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

};

Slide11

Private By Default

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

class Fraction

{

int

m_Numerator

;

int

m_Denominator

;

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

};

Slide12

Definition and Use

//

fraction.h

#

ifndef

FRACTION_H

#define FRACTION_H

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

#

endif

#include

fraction.h

int

main()

{

Fraction f, g;

f.m_Numerator

= 7;

f.readin

();

f.print

();

f.unreduce

(5);

return 0;

}

Slide13

Definition and Use

//

fraction.h

#

ifndef

FRACTION_H

#define FRACTION_H

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

#

endif

#include

fraction.h

int

main()

{

Fraction f, g;

f.m_Numerator

= 7;

f.readin

();

f.print

(); f.unreduce(5); return 0;}

Slide14

Definition and Use

//

fraction.h

#

ifndef

FRACTION_H

#define FRACTION_H

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

#

endif

#include

fraction.h

int

main()

{

Fraction f, g;

f.m_Numerator

= 7;

f.readin

();

f.print

(); f.unreduce(5); return 0;}

//

won’t compile!

Slide15

Definition and Use

//

fraction.h

#

ifndef

FRACTION_H

#define FRACTION_H

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

#

endif

#include

fraction.h

int

main()

{

Fraction f, g;

f.m_Numerator

= 7;

f.readin

();

f.print

(); f.unreduce(5); return 0;}

Slide16

Definition and Use

//

fraction.h

#

ifndef

FRACTION_H

#define FRACTION_H

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

#

endif

#include

fraction.h

int

main()

{

Fraction f, g;

f.m_Numerator

= 7;

f.readin

();

f.print

(); f.unreduce(5); return 0;}

Slide17

Definition and Use

//

fraction.h

#

ifndef

FRACTION_H

#define FRACTION_H

class Fraction

{

public:

void

readin

();

void print();

Fraction reciprocal();

void unreduced(const

int

m);

private:

int

m_Numerator

;

int

m_Denominator

;

};

#

endif

#include

fraction.h

int

main()

{

Fraction f, g;

f.m_Numerator

= 7;

f.readin

();

f.print

(); f.unreduce(5); return 0;}

Slide18

End of Session