|
-
Jan 18th, 2003, 01:41 PM
#1
Namespaces and visibility.
I'm trying to derive my own class from System.Drawing.Image which represents a bitmap stored in a DirectDraw offscreen surface.
But when I compile it gives me the error
'System.Drawing.Image.Image()' is inaccessible due to its protection level
for every constructor of my class.
Now I would normally guess that this means the constructor is protected, internal or private. But:
It can't be protected, my derived class would have access to it.
It can't be private, else no class could be derived from Image (there's no friend keyword in C#, right?).
It can't be internal, because a) I placed my image class in System.Drawing and b) System.Drawing.Imaging.Metafile is derived from Image and has access.
Why does it deny me the access? How can I solve this problem?
Code:
public class DdImage : System.Drawing.Image
{
//...
public new int Flags
{
get
{
return 0;
}
}
public new Guid[] FrameDimensionsList
{
get
{
return null;
}
}
// etc.
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 18th, 2003, 02:00 PM
#2
Frenzied Member
Because System.Drawing.Image is an abstract class.
Dont gain the world and lose your soul
-
Jan 18th, 2003, 02:03 PM
#3
I know that. I'm deriving from it. I never call any Image constructor explicitly. But the compiler gives me errors!
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 18th, 2003, 04:08 PM
#4
Ok, as it is I'll assume Image is somehow guarded in it's namespace (still seems strange to me).
Damn, that would have been nice.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 18th, 2003, 09:42 PM
#5
PowerPoster
You might want to use the Bitmap class instead. I think there is the same functionality and you can create an instance of it.
-
Jan 18th, 2003, 10:13 PM
#6
yay gay
Code:
public new int Flags
{
get
{
return 0;
}
}
what does this do? proprieties aren't in the format of:
<access> <type> <name> ? what does the new do?
\m/  \m/
-
Jan 18th, 2003, 10:29 PM
#7
Frenzied Member
-
Jan 19th, 2003, 12:35 AM
#8
Frenzied Member
what does this do? proprieties aren't in the format of:
<access> <type> <name> ? what does the new do?
The new keyword is there to hide a member with the same name in the base class.
Dont gain the world and lose your soul
-
Jan 20th, 2003, 04:22 AM
#9
Yep, it won't allow me nothing, it won't allow me override, so I have to use new.
Bitmap does too much of its own. I don't want it allocating memory behind my back.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 20th, 2003, 04:25 AM
#10
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 20th, 2003, 04:26 AM
#11
Could it be that I have to implement ALL public methods and properties from Image, even when they are derived from another class (MarshallByRefObject or Object)?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|