Requesting help with "Instance"...

MAVstdntOfVBdotNET

New member
Joined
Oct 30, 2006
Messages
1
Programming Experience
Beginner
I am a student trying to get through Intro to VB.NET on-line.... I am attempting to Create a "Customer" & "Phone" instance and than Invoke a TELLAboutSelf - Console.WriteLine to display...... Can anybody help....

Here is what it looks like:

VB.NET:
Sub Main()
 
Dim phone1, phone2, phone3 As Phone
 
Dim customer1, customer2, customer3 As Customer
 
' create 3 instances of phone
phone1 = New Phone(314, 1234567, "Home")
phone2 = New Phone(417, 7654321, "Home")
phone3 = New Phone(303, 4561233, "Home")
 
' create 3 instances of Customer
customer1 = New Customer("Henry", "St. Louis", "467-4546")
customer2 = New Customer("Joht", "Detroit", "123-4564")
customer3 = New Customer("Henry", "Colo Springs", "789-1245")
 
' display phone info & display Customer info 
Console.WriteLine(phone1.TellAboutSelf())
Console.WriteLine(customer1.TellAboutSelf())
Console.WriteLine(" ")
 
Console.WriteLine(phone2.TellAboutSelf())
Console.WriteLine(customer2.TellAboutSelf())
Console.WriteLine(" ")
 
Console.WriteLine(phone3.TellAboutSelf())
Console.WriteLine(customer3.TellAboutSelf())
Console.WriteLine(" ")
 
End Sub

The book explains to add the "As Phone" & "As Customer" to the end
of the "Dim"........ but where ever Phone or Customer are in the program
they are pointed out as "Type NOT defined"............. Can anyone help...

Thanks
 
Last edited by a moderator:
If you haven't defined the Customer and Phone classes first then you can't create instances of them. How is your application know what a Customer or a Phone is if you don't tell it? In the real world, if I told you to build me a Brequinezzel would you be able to? No you wouldn't, because you have no idea what a Brequinezzel is. You app has no idea what a Customer or a Phone is.
 
Back
Top