TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Arkay Mann
NA
4
0
What does this code do?
Apr 14 2010 6:30 PM
I'm learning c#. Most things I do understand but in this book I'm reading is this example.
abstract class GenericCustomer {
private string name;
public GenericCustomer() {
name = "<no name>";
}
// lots of other methods
}
class Nevermore60Customer: GenericCustomer {
private uint highCostMinutesUsed;
// other methods etc.
}
The class is instantiated with
GenericCustomer customer = new Nevermore60Customer();
I would understand this instantiation
Nevermore60Customer customer = new Nevermore60Customer();
but I don't understand the example.
If I read it correctly it is creating an object of type GenericCustomer which is an abstract class (I didn't think you could do that) or is it a cast that creates a Nevermore60Customer but casts it as GenericCustomer (again I didn't think you could do that).
BTW I tried the code and it works. I also tried
Nevermore60Customer customer = new Nevermore60Customer();
and it works to.
Reply
Answers (
1
)
contrast of image
how can i transfer Combobox control's data from one form to another form in windows