Partial Classes and Inheritance

B

Bishoy George

In a web application using asp.net 2.0

All my classes are partial classes.

- I noticed that partial class cannot be inherited... is that true?

- I tried to remove the partial keyword , and I receieved this error
Error 1 Missing partial modifier on declaration of type
'NagyResearch.Q_A.Q.QuestionnairePage'; another partial declaration of this
type exists D:\Web Sites\Local
Host\NagyResearch\Q_A\Q\QuestionnairePage.aspx.cs 14 18
http://localhost/NagyResearch/

although I haven't any another partial declaration.
 
K

Kevin Spencer

Partial classes can't be compiled either. However, the complete classes that
are created either from one part of a partial class which can be used as a
stand-alone class, or from several partial classes combined, can be
compiled, inherited, you name it.

The key here is that a "partial class" is not a class at all. It is a
convenience for the developer, a way of separating the code which
constitutes a class when built can be spread across several source files. In
addition, it provides the ability to recombine these partial class files
into a variety of different versions of a class. I'm not sure how useful
that is, though.

The actual *class* doesn't exist until it is compiled.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.
 

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