Android Question [Solved] Classes Quiz ^__^

LucaMs

Expert
Licensed User
Longtime User
Today I spent too much time at the pc: 25/24 hours instead of the usual 22/24 :D, so I'm a little tired
and I do not think I can explain what I mean to ask.

In addition, after the failure of one of my previous similar question...!

Given the "impossibility" of using global variables:

If I have a CLASS "Student" (not an instance-object) and a CLASS "Students" (which will contain some Student objects, when instantiated), how can I inform Students (object) that a property of a Student object has been changed?
I mean how to design(project-plan) this directly in the classes!


It seems, but I'm not mad (not fully :confused: :p)
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Uhm... maybe I could set a property in Student like "LastUpdate" (unfortunately, I should set it on each property and method, or almost)
and Students should check it (again unfortunately, in the first line of each property/method and on all Student children!).

Any other suggestion?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
another "not ideal" solution:

an array (or list or map) in the Student which contains references to the Parents (all Students objects) to be informed of any changes.

Example:
' Project code
Students.AddStudent(FirstStudent)

' Students Class
Public Sub AddStudent(Student as clsStudent)
...
...
Student.AddParent(Me)
End Sub

' Student Class
public Sub setName(Name as String)
mName = Name
InformParents
End Sun


Could that "me" work?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Upvote 0
Top