OOP - objects and instances -
this question has answer here:
- difference between object , instance 18 answers
i have seen lot of posts objects, classes , instances , have become little confused. need clarification following example.
say create game, has 3 menus:
- main menu,
- level menu
- option menu.
now define class called gamemenu since these menus have titles , instructions , buttons etc... instantiate menus using class example:
mainmenu = gamemenu(); levelmenu = gamemenu(); optionmenu = gamemenu(); and pass parameters titles , button labels , such inside brackets - in context of example right in saying class gamemenu, objects collectively mainmenu, levelmenu , optionmenu, , instances 1 specific object mainmenu instance, optionmenu instance , levelmenu instance.
that taught, means objects , instances exact same things in case terms object , instance synonyms each other not have read?
long story short, object , instance terms synonyms?
an object instance of class
Comments
Post a Comment