[{"data":1,"prerenderedAt":285},["ShallowReactive",2],{"paradigm-object-based":3,"paradigm-members-object-based":280},{"id":4,"title":5,"assets":6,"author":7,"body":8,"description":40,"extension":251,"features":252,"homepage":6,"logo":6,"meta":256,"name":5,"navigation":257,"note":258,"paradigm":259,"path":260,"references":261,"relations":271,"seo":275,"status":276,"stem":277,"tour":6,"urls":6,"year":278,"__hash__":279},"paradigms\u002Fparadigms\u002Fobject-based.md","Object-based",null,"Luca Cardelli and Peter Wegner (the distinction)",{"type":9,"value":10,"toc":244},"minimark",[11,16,26,30,181,198,202,221,225,233,237,240],[12,13,15],"h2",{"id":14},"overview","Overview",[17,18,19,20,25],"p",{},"An object-based language defines objects and classes but no inheritance, so a\nclass bundles state and behaviour without a superclass to refine. Cardelli and\nWegner drew that line in 1985 so objects, classes and inheritance could be\nweighed as separate choices; ",[21,22,24],"a",{"href":23},"\u002Flanguages\u002Fvbscript","VBScript"," is a late example.",[12,27,29],{"id":28},"code","Code",[31,32,33,116],"code-group",{},[34,35,41],"pre",{"className":36,"code":37,"filename":38,"language":39,"meta":40,"style":40},"language-vbscript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","Class Account\n    Private m_balance\n    Private Sub Class_Initialize\n        m_balance = 0\n    End Sub\n    Public Property Get Balance\n        Balance = m_balance\n    End Property\n    Public Sub Deposit(amount)\n        m_balance = m_balance + amount\n    End Sub\nEnd Class\n","abstractions","vbscript","",[28,42,43,51,57,63,69,75,81,87,93,99,105,110],{"__ignoreMap":40},[44,45,48],"span",{"class":46,"line":47},"line",1,[44,49,50],{},"Class Account\n",[44,52,54],{"class":46,"line":53},2,[44,55,56],{},"    Private m_balance\n",[44,58,60],{"class":46,"line":59},3,[44,61,62],{},"    Private Sub Class_Initialize\n",[44,64,66],{"class":46,"line":65},4,[44,67,68],{},"        m_balance = 0\n",[44,70,72],{"class":46,"line":71},5,[44,73,74],{},"    End Sub\n",[44,76,78],{"class":46,"line":77},6,[44,79,80],{},"    Public Property Get Balance\n",[44,82,84],{"class":46,"line":83},7,[44,85,86],{},"        Balance = m_balance\n",[44,88,90],{"class":46,"line":89},8,[44,91,92],{},"    End Property\n",[44,94,96],{"class":46,"line":95},9,[44,97,98],{},"    Public Sub Deposit(amount)\n",[44,100,102],{"class":46,"line":101},10,[44,103,104],{},"        m_balance = m_balance + amount\n",[44,106,108],{"class":46,"line":107},11,[44,109,74],{},[44,111,113],{"class":46,"line":112},12,[44,114,115],{},"End Class\n",[34,117,120],{"className":36,"code":118,"filename":119,"language":39,"meta":40,"style":40},"' no inheritance: reuse arrives by holding an instance and forwarding.\nClass LoudAccount\n    Private m_inner\n    Private Sub Class_Initialize\n        Set m_inner = New Account\n    End Sub\n    Public Sub Deposit(amount)\n        m_inner.Deposit amount\n    End Sub\n    Public Property Get Balance\n        Balance = m_inner.Balance\n    End Property\nEnd Class\n","idioms",[28,121,122,127,132,137,141,146,150,154,159,163,167,172,176],{"__ignoreMap":40},[44,123,124],{"class":46,"line":47},[44,125,126],{},"' no inheritance: reuse arrives by holding an instance and forwarding.\n",[44,128,129],{"class":46,"line":53},[44,130,131],{},"Class LoudAccount\n",[44,133,134],{"class":46,"line":59},[44,135,136],{},"    Private m_inner\n",[44,138,139],{"class":46,"line":65},[44,140,62],{},[44,142,143],{"class":46,"line":71},[44,144,145],{},"        Set m_inner = New Account\n",[44,147,148],{"class":46,"line":77},[44,149,74],{},[44,151,152],{"class":46,"line":83},[44,153,98],{},[44,155,156],{"class":46,"line":89},[44,157,158],{},"        m_inner.Deposit amount\n",[44,160,161],{"class":46,"line":95},[44,162,74],{},[44,164,165],{"class":46,"line":101},[44,166,80],{},[44,168,169],{"class":46,"line":107},[44,170,171],{},"        Balance = m_inner.Balance\n",[44,173,174],{"class":46,"line":112},[44,175,92],{},[44,177,179],{"class":46,"line":178},13,[44,180,115],{},[182,183,184],"note",{},[17,185,186,187,190,191,194,195,197],{},"The two slots are the definition in miniature: ",[28,188,189],{},"Class"," plus ",[28,192,193],{},"Private"," members\nencloses state behind a public property, and the object-based substitute for\ninheritance is delegation — a field of the enclosing type and one forwarding\nmethod per reused member. Paraphrased from the VBScript ",[28,196,189],{}," statement\nreference; the source's notation stays authoritative.",[12,199,201],{"id":200},"distinctive-traits","Distinctive traits",[203,204,205,209,212,215,218],"ul",{},[206,207,208],"li",{},"The boundary is inheritance, not objects: private state behind public\nproperties still leaves a language object-based under Wegner's definition.",[206,210,211],{},"Classless design also qualifies: Wegner folds delegation-based languages\n(prototypes, actors) into the same object-based space as class templates.",[206,213,214],{},"Encapsulation survives the downgrade: access control and constructors carry\nobject-based design without any class hierarchy to hang it on.",[206,216,217],{},"Delegation replaces inheritance in practice — an object holds another and\nforwards to it, so reuse is manual and per member rather than structural.",[206,219,220],{},"The tiers nest: object-based, class-based and object-oriented name\nprogressively narrower feature sets, inheritance being the last one added.",[12,222,224],{"id":223},"status","Status",[17,226,227,228,232],{},"Still the standard classification for languages with objects and without\ninheritance, and still applied where inheritance is deferred to prototypes. Its\nboundary is contested: some writers count delegation as\n",[21,229,231],{"href":230},"\u002Fparadigms\u002Fobject-oriented","object orientation",", collapsing the two.",[12,234,236],{"id":235},"history","History",[17,238,239],{},"Cardelli and Wegner popularized the split in their 1985 survey of types,\nabstraction and polymorphism. Wegner gave it a design space at OOPSLA in 1987,\ncharacterizing object-based languages along objects, classes, inheritance, data\nabstraction, strong typing, concurrency and persistence, and treating actors and\nprototypes as classless members of the same space rather than a separate\ncategory.",[241,242,243],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":40,"searchDepth":53,"depth":53,"links":245},[246,247,248,249,250],{"id":14,"depth":53,"text":15},{"id":28,"depth":53,"text":29},{"id":200,"depth":53,"text":201},{"id":223,"depth":53,"text":224},{"id":235,"depth":53,"text":236},"md",[253,254,255],"encapsulation","class-templates","no-inheritance",{},true,"Languages that define objects and classes but stop short of inheritance. Wegner's distinction separates object functionality and object management from class management by inheritance, which is what object-oriented adds.","object-based","\u002Fparadigms\u002Fobject-based",[262,265,268],{"url":263,"title":264},"https:\u002F\u002Fdoi.org\u002F10.1145\u002F38765.38823","Peter Wegner — Dimensions of Object-Based Language Design (OOPSLA '87)",{"url":266,"title":267},"https:\u002F\u002Fdoi.org\u002F10.1145\u002F6041.6042","Cardelli and Wegner — On Understanding Types, Data Abstraction, and Polymorphism (ACM Computing Surveys, 1985)",{"url":269,"title":270},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fprevious-versions\u002F4ah5852c(v=vs.85)","Class Statement (VBScript) — Microsoft Learn",[272],{"name":273,"kind":274},"object-oriented","shares-ancestor-with",{"title":5,"description":40},"active","paradigms\u002Fobject-based",1985,"Qq_uE-ro7hs0oZzKh3wEV71yhdorKUf3JiWTDEvkbmc",[281],{"name":24,"path":23,"logo":6,"year":282,"kind":283,"note":284},1996,"dialect","Microsoft's scripting subset of Visual Basic for Internet Explorer, IIS and the Windows Script Host. One Variant data type, late-bound COM automation, and classes without inheritance; deprecated since 2023 and on a phased removal path.",1795219071424]