I'm a programming hobbyist. I'm used to using pointers to objects and I am comfortable working with them. What am I missing by not using classes?
The reason why I am asking is because with an object that "owns" another object, to have a child of the "owned" object work correctly I have to do a typecast to access the child object's variables and methods that are added. Here's what I'm talking about:
type
PLg_Taskbar=^LG_Taskbar;
LG_Taskbar = object(baseobject);
constructor init;
procedure paint;virtual;
destructor done;
end;
PLg_Application = ^LG_Application;
LG_Application = Object(baseobject)
taskbar:PLG_Taskbar;
constructor buildapp;
procedure paint;virtual
destructor done;
end;
PLG_NewTaskbar = ^LG_NewTaskbar;
LG_NewTaskbar = object(LG_taskbar)
Showing:boolean; // have to typecast to access
constructor buildnewtaskbar;
procedure paint;virtual;
procedure hide;virtual; // have to typecast to access
end;
So when I create a taskbar owned by the application the code I use is
Taskbar := new(PLG_NewTaskbar,buildnewtaskbar);
To access the new taskbar's hide method I have to do this
Plg_NewTaskbar(taskbar)^.Hide;
Does this issue also happen with classes (and pointers to classes)?