Sowithinstance, propertiestakingintobasicallyexampleoff a humanbeing a humanmighthave a nameandageand a hotsoandinstance, propertydescribesthecurrentstate's offthatobjectwhattheyhave.
Okay, let's justmakethis a fiveand a threesongoutrunningThislineofcoderightherecreates a rectanglewiththatwiththewidthofffivehotoffthreeat a coloroffblue.
Sotheseareallpassedinandinsertedrightthere.
Sonowif I wastosavethisoneandrefreshthebrother, wegetthesameresultthisjustlogouttheactualrectangleobject.
Wegotthisrectanglewiththefivepartofthreeon a coloroffblue.
Sotoworkout, I believetheareaoff a rectangle, hemultipliedthewidthandtheheartsowecanactuallycreate a methodwhichwillgiveustheareaoffthisrectangleortheexamplebeingcreated.
Let's make a methodthatwillactuallyprintout a descriptionofftheactualobject.
Let's saydescriptionOkay.
Insidehere.
Let's justsayConsul, don't lookandthenjustsaysomethinglike, um, on a rectangle, allinthemissusputthethewitnessheartwillsaythisstuffwithAndthen, umthisishot.
Thenwe'llsayand I amandthentheactualcolor.
Sonow, bycallingthisPrincedescriptionmethodonrectangleweget I'm a rectangleoffwithTom's heartand I amthanthecolor.
Now, the 1st 1 beingobviously a squareonthe 2nd 1 beinganothersweet, let's justsay A and B.
So A and B aretwodifferentsquareinstances, andtheEaglesaestheticmethodisgoingtochecktheWittenheartoffthesetwosquaresandthengiveustheresultiftheyareequalornotequal.
Sothat's just, um, thisis a return.
Thenusetheturneryoperetta.
Let's justsayonreturnif I don't we, um, times a height.
Okay, Soaestheticmethods I usedfor, I guessHelperHelperfunctionssothey'restillrelevanttotheactualclass, buttheydon't actuallyrequireaninstanceoffthatclasstowork.
Infact, if I wastojustgetridofthesetwoguysrighthere, Okay?
Saveeveryfresh.
Westillgetthesameresult.
There's noairoranything, soyoucanseehowit's sortoflike a helpoffunction.
So, um, you'rebasicallygonnausethiswheneveryouhave a genericclassandthenyouwanttoactuallycreate a newchildclassoffthatgenericonewhilestillmaintainingitsfeaturesandbehavior, but a littlebitextra.
Sobasically, it's whenyouhave a periodclasstocreate a childclass.
Okay, solet's seehowtoactuallydothis.
So I'm gonnacreate a newclasshere, andthiswillbe a representationof a person.
Soasyoucansee, a normalpersonwon't beabletoactuallybepassedintothisarraybecauseweexpectprogramisnot a genericpersonwithnoattributesonthisschooloroccupation.
Sowe'reactuallygoingtocreate a childclasswhichinheritsfromthispersonclass, andthesechildclassisgonnabe a programsowecanachievethisbycreating a newclass.
Sonowwehave a programwhichextends a person, whichmeansittakesinalltheattributesandbehavioroffthisperson's nameandageonthatalso, whohaveitsowncustom, um, behaviorandprobablyisitself.
So, um, I justcreate a newmethodinside, thepersonwillquickandjustsaysomethinglikeDescribesomethingthat's describe.
Thisisjustsimplyconsole.
Don't log.
Um, a messagesaying I am, andintheirnames.
So I am.
I don't And I am.
Hey, yearsold.
Okay, saythis.
Start.
Namethisprogram.
A classisgonnahaveaccesstonotonlytheseproperties, butalsoaccesstothedescribemethod.
Okay, So, Dan, here, let's createtheconstructorfortheseprograms.
Topyetconstructedhere, it's worthtaking a nameandanage.
Sothephysicallistelementwiththeitemscontainedintextlistsoyoumayattendand a writeoffofstringsandthentheupdatemethodsactuallygonnainsert a llthesestringsintothephysicallistelementyetproperty, allthiselement.
Sowe'regonnamakeaestheticmethodcalledcreateleastAutumn, whichwillgenerateaneightteam l elementforforthetextthatispastit.
Allright, solet's justmakethisstudyclassallthisaestheticmethodrightnowuphere, let's say I studybeforethisonecreatethisautumn, whichtakesin a singleargumentbeingtextsokayforthebody.
Let's justmake a newconstantyearcalledthisoneallyequaltoit's documentedtreeGetelementoftenAllied.
Andthenwe'remaking a newinstanceofftheleastbondingclasspassingintheactualphysicalonorderedlistelementfrombayintheclass.
Intheconstructor, wearemaintaining a referencetotheactuallistelementpropertyandthenmakinganunderlyingarraytostoreallthesestringsoftexttobaydisplayinsidetheupdatemethod, weareremovingalltheexistinglistautumnelementsandthenfillinguptheactual U L ortheoltags.
Uh, puttingtheactualtextinsidethatfullyadmittedwearesimplyjustadding, adding a anautumntotheactualarrayandthenusingtheupdatemethodtoactuallyupdatethedumboncethathasbeenatit.