N
Noozer
I've always had problems getting my head around using collections and
classes together. Separately, they seem like fairly simple subjects, but I'm
getting muddled up when trying to use them together.
Even trying to cobble together an example to post here with my question has
me confused.
Can someone toss together a simple example of how I'd create my classes and
collection?
What I was going to use was...
Class "cName" with properties of "First" and "Last"
Class "cMovie" with properties of "Title" and "Year"
Class "cActor" with properties of a "cName" and a collection of "cMovie"'s
So in my code I'd do...
<%
Dim Actor
Set Actor = New cActor
Actor.FirstName = "Pierce"
Actor.LastName = "Brosnan"
Actor.Movies.Add "Tomorrow Never Dies","1997"
Actor.Movies.Add "GoldenEye","1995"
Actor.Movies.Add "The World is Not Enough", "1999"
response.write "Actor: " & Actor.FirstName & " " & Actor.Lastname & "<br>"
response.write "Films: <br>"
Dim Film
for each Film in Actor.Movies
response.write Film.Title & " in " & Film.Year & " <br>"
next
%>
classes together. Separately, they seem like fairly simple subjects, but I'm
getting muddled up when trying to use them together.
Even trying to cobble together an example to post here with my question has
me confused.
Can someone toss together a simple example of how I'd create my classes and
collection?
What I was going to use was...
Class "cName" with properties of "First" and "Last"
Class "cMovie" with properties of "Title" and "Year"
Class "cActor" with properties of a "cName" and a collection of "cMovie"'s
So in my code I'd do...
<%
Dim Actor
Set Actor = New cActor
Actor.FirstName = "Pierce"
Actor.LastName = "Brosnan"
Actor.Movies.Add "Tomorrow Never Dies","1997"
Actor.Movies.Add "GoldenEye","1995"
Actor.Movies.Add "The World is Not Enough", "1999"
response.write "Actor: " & Actor.FirstName & " " & Actor.Lastname & "<br>"
response.write "Films: <br>"
Dim Film
for each Film in Actor.Movies
response.write Film.Title & " in " & Film.Year & " <br>"
next
%>