Groups | Blog | Home
all groups > c# > january 2007 >

c# : Instance with Inheritance


mask.sd NO[at]SPAM gmail.com
1/30/2007 11:50:25 PM
Can We create the instance of class with Inheritance like following :

Derivedclassname var = new Baseclassname
Jon Skeet [C# MVP]
1/31/2007 12:25:44 AM
[quoted text, click to view]

If you mean something like:

string x = new object();

then no, you can't - because the created object is *not* a string.

Jon
Peter K
1/31/2007 4:52:26 AM
Otis Mukinfus <phoney.email.address@phoney.com> wrote in
news:r031s21km9gsjm1e9gnv4pbovg0v6p4i2d@4ax.com:

[quoted text, click to view]

Quite, but it could be that the OP did indeed try this and wondered why it
didn't work. The precise phrasing of his question could itself be
questioned, but remember lots of posters do not have English as a first
language and posing accurate, succinct, and technically and grammatically
correct questions can pose a challenge.

Otis Mukinfus
1/31/2007 6:37:16 AM
[quoted text, click to view]

Paul,

Great answer!

I always wonder in these days of VS2k5 and the way one creates a project why
folks ask questions about things they could test in ten minutes instead of
waiting for some to answer their question. I mean no offense by saying this. I
just wonder why they don't make a test first.

It takes less than a minute to create a project. Maybe three to five minutes to
write the test code. Another minute to run the test. Another 30 seconds to
delete the project.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
Paul Hadfield
1/31/2007 8:02:45 AM
Why not try it?

[quoted text, click to view]

Otis Mukinfus
1/31/2007 1:13:08 PM
[quoted text, click to view]

Thank you for the admonishment, Peter. My post was directed at Paul, not the
OP, but I certainly did forget to consider that a member of the
thought/political correctness police might read my post.

By the way, Peter, what information did you give the OP regarding the post? I
didn't see one. Maybe I missed it somewhere.

Good luck with your project,

Otis Mukinfus

http://www.otismukinfus.com
http://www.arltex.com
http://www.tomchilders.com
Peter
1/31/2007 8:58:21 PM
[quoted text, click to view]

It wasn't really meant as an admonishment. It was really just in case you
(and Paul) hadn't thought of that possibility.

[quoted text, click to view]


Yes, well, there you go.

[quoted text, click to view]

No, I don't think you missed that. I didn't supply the OP with any
information regarding his question (much as neither you nor Paul did) - Jon
Skeet (as usual) provided a nice answer which was probably sufficient for
the OP's needs, and I am certainly not up to Jon's standards when it comes
to knowledge of c#.

[quoted text, click to view]

?

Good luck with your attitude.

AddThis Social Bookmark Button