Author |
Message |
Samapico No, these DO NOT look like penises, ok?

Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sun Apr 20, 2008 1:03 pm Post maybe stupid Post subject: |
 |
|
|
|
interesting _________________ (Insert a bunch of dead links here) |
|
Back to top |
|
 |
Animate Dreams Gotta buy them all! (Consumer whore)

Age:37 Gender: Joined: May 01 2004 Posts: 821 Location: Middle Tennessee Offline
|
Posted: Sun Apr 20, 2008 3:19 pm Post maybe stupid Post subject: |
 |
|
|
|
badass
so myclass.tostring is automatically called when someone tries to treat the class as a string? |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sun Apr 20, 2008 4:31 pm Post maybe stupid Post subject: |
 |
|
|
|
Welcome to the wonderful world of Duck Typing. _________________ It's a shark! Oh my god! Unbelievable! |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sun Apr 20, 2008 4:49 pm Post maybe stupid Post subject: |
 |
|
|
|
Animate Dreams wrote: | so myclass.tostring is automatically called when someone tries to treat the class as a string? |
Not exactly. What's happening in this case is that you're actually calling the WriteLine method that takes an object as a parameter and it calls ToString. What you're talking about will happen if you're adding it to a string literal ("hello, " + object) because the + operator is overloaded, but you can't just throw an Object anywhere something calls for a String. _________________
 |
|
Back to top |
|
 |
Cheese Wow Cheese is so helpful!

Joined: Mar 18 2007 Posts: 1017 Offline
|
Posted: Sat Apr 26, 2008 1:07 am Post maybe stupid Post subject: |
 |
|
|
|
personally i prefer cout and cin, because you have to type less, and its easier to read.
ie > ff
and goto is always fun =) _________________ SSC Distension Owner
SSCU Trench Wars Developer |
|
Back to top |
|
 |
|