100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Solution Manual For Concepts of Programming Languages 11th Edition by Robert Sebesta

Rating
4.0
(1)
Sold
-
Pages
96
Grade
A+
Uploaded on
26-02-2025
Written in
2024/2025

Solution Manual For Concepts of Programming Languages 11th Edition by Robert Sebesta

Institution
Module











Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Module

Document information

Uploaded on
February 26, 2025
Number of pages
96
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Object-Orientedg Programmingg (CSC221)
Introduction

Whatg isg OOP
• Ing simpleg term,g OOPg isg programmingg withg objects.
• Objects
o Objectsg areg theg evolutionaryg extensiong ofg theg conceptg ofg recordsg thatge
nablegusgtogorganizegdatagintogpackages.
o Itg allowg usg tog combineg bothg datag andg codeg intog ag singleg package.
o Therefore,g ang objectg isg ag languageg constructg thatg tiesg datag withg theg functionsg
thatgoperatesgongthegdata.


OOPg viewpoint

Lowglevelg object




Windowg object FilegManagement
gobject




Wordgprocessing Editinggobject
gApplication




Keyboardgcontrol
gobject




Theg figureg aboveg showg howg tog createg ag setg ofg objectsg forg ag wordg processorg application.

• Theg arrangementg isg dividedg intog objectsg suchg asg lowg levelg object,g windowg
object,gfilegmanagementgobjectsgetc.


Advantages
- Majorg operationg ofg ag programg cang easilyg beg isolated.
- Someg objectsg areg usedg tog createg otherg objects.
- Thisg helpsg tog hideg theg detailsg ofg theg lowerg levelg objects.


Traditional programming vs OOP
g g g

- Ing traditionalg view,g functionsg areg theg mostg important,g i.e.g allg theg codeg ing ag programg i
sgdesignedgaroundgthegfunctions.
- Ing theg OOPg view,g objectsg areg theg mostg important,g programsg areg designedg aroundg objects,
gfunctionsgaregsecondary




7

,- Thisgrolegrevealsgingthegwaygobjectsgaregused,grathergthangpassinggobjects(data)gtogfun
ctions,gobjectsgaregusedgtogcallgfunctions.
- Programsgcangavoidglargegfunctionsgthatgcontainglogicgforgmultiplegcases,ginsteadgmulti
plegobjectsgaregcreatedgtogrepresentgthegdifferentglogicalgcomponentsgofgagprogram.

Componentsg ofg OOP
• Classes
• Objects
• Instanceg variables
• Methods


Classes and objects
g g




- Ag classg isg ang abstractg definitiong ofg ang object
o Itg definesg theg structureg andg behaviourg ofg eachg objectg ing theg class.
o Itg servesg asg ag templateg forg creatingg objects

- objectsg mayg beg groupedg intog classes
o Ag particularg objectg ofg ag classg isg ang instance.

- Theg figureg belowg illustrate:



Classg =g typegdefinitiongObj
ectg=gvariablegofgagclass.

1.exe




- Ag classg containg twog typesg ofg components
o Instanceg variables
o g Methods
1.exe




- Instanceg variablesg defineg theg internalg datag stateg ofg ang object
- Methodsg defineg ang object‟sg behavior,g thatg isg theg actionsg thatg theg objectg can
perform.

Sampleg class

• Class

Properties Course Behaviour

Name Addg ag student
Location Deleteg ag student
Daysg offered Getg courseg roster
Creditg hours ….
Startg time e.t.c




8

,Endg time



Theg threeg faces(properties)g ofg OOP

WhengprogramminggwithgC++g„sgobjectgorientedg features,g thereg areg threeg underlyinggp
ropertiesgthatgsurfacegagaingandgagain:
• Encapsulation
• Polymorphism
• Inheritance

Encapsulation
- Encapsulationg isg thegtechniqueg ofg combiningg datag andg theg operationsg neededg tog
processgthegdatagundergonegpackage[object].
- Itg isg whatg givesg objectsg theirg buildingg blockg flavor.
- Encapsulationg providesg twog importantg features:
o Putsg datag andg functionsg underg oneg roof.
o Providesg datag hidingg capabilities.




Polymorphism
- Polymorphismgisg theg qualitygthatgallowsg oneg nameg togbeg usedg forgtwogorgmoreg relatedg butg
technicallygdifferentgpurposes.

- Polymorphismg allowsg oneg nameg tog specifyg ag generalg classg ofg actions.g Withing ag general
gclassg ofg actions,g theg specificg actiongtog beg appliedg isgdeterminedg byg theg typeg ofg data.

Forgexample,gingC,gthegabsolutegvaluegactiongrequiresgthreegdistinctgfunctiongnames:gabs(g)gforginteger,glabs(g)gf
orglongginteger,gandgfabs(g)g forgfloating-
pointgvalue.gHowevergingC++,geachgfunctiongcangbegcalledgbygthegsamegname,gsuchgasgabs(g).gThegtypegofgdatag
usedgtogcallgthegfunctiongdeterminesgwhichgspecificgversiongofgthegfunctiongisgactuallygexecuted.

-
Ing C++g itg isg possibleg tog useg oneg functiong nameg forg manyg differentg purposes.g Thisg typ
eg ofgpolymorphismgisgcalledgfunctiongoverloading.

- Polymorphismgcangalsogbegappliedgtogoperators.gIngthatgcasegitgisgcalledgoperatorgoverloading.
- Theg abilityg tog hideg manyg differentg implementationsg behindg ag singleg interface.


Whatg isg ang interface?
- Ag namedg setg ofg operationsg thatg characterizeg theg behaviourg ofg ang element.
• Theg interfaceg formalizesg polymorphism

<<interface>>
Triangle
gPolygon

, 9

draw
Square
$20.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

Reviews from verified buyers

Showing all reviews
9 months ago

4.0

1 reviews

5
0
4
1
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GOLDENNTESTBANKS Teachme2-tutor
Follow You need to be logged in order to follow users or courses
Sold
9
Member since
9 months
Number of followers
1
Documents
461
Last sold
7 months ago

4.5

480 reviews

5
294
4
145
3
35
2
4
1
2

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions