C# classes quesitons

P

puzzlecracker

1. Can an abstract class have some implementation (say default
assuming derived chooses not to implement it)?

2. Does CSharp has a concept of inner class comparable to java's,
where inner class can reference into wrapping class?

3. How is virtual, and polymorphism in general, is implemented?


Thanks
 
D

Duggi

1. Can an abstract class have some implementation (say default
assuming derived chooses not to implement it)?

2. Does CSharp has a concept of inner class comparable to java's,
where inner class can reference into wrapping class?

3. How is virtual, and polymorphism in general,  is implemented?

Thanks
1. Can an abstract class have some implementation (say default
assuming derived chooses not to implement it)?

Abstract class can have implementation for some of the methods. If a
class that is derived from an abstract class, chooses not to override
the abstract method, the class should be abstract again.
2. Does CSharp has a concept of inner class comparable to java's,
where inner class can reference into wrapping class?

If you mean class declared with in another class, Yes, it is
supported.
3. How is virtual, and polymorphism in general, is implemented?

it is implemented with the virtual and override keywords.

http://www.vijaymukhi.com/documents/books/csbasics/chap9.htm
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=374

explains the ovverride concept in C#

-Cnu
 
A

Alex Meleta

Hi puzzlecracker,
1. Can an abstract class have some implementation (say default assuming
derived chooses not to implement it)?
the best way to remember the difference is first of all it's a class, and
only then it's abstract. So, as a class it has implementation, but, because
it's abstract it cannot be instantiated.

Regards, Alex Meleta
[TechBlog] http://devkids.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top