Reputation: 524
I have a class that is a child of System.Drawing.Bitmap
. I am trying to call its constructor but I have a problem during the call of the base class constructor.
More specifically I want to call that particular constructor:
Bitmap(String)
: Initializes a new instance of the Bitmap class from the specified file.
I think the problem is that it does not recognize that my class inherits from the Bitmap
class, because the error refers to the Object class.
In any case, here is my class:
class MyBitmap : Bitmap
{
private String photographer, description, title;
public String Photographer
{
get
{
return this.photographer;
}
}
public String Description
{
get
{
return this.description;
}
}
public String Title
{
get
{
return this.title;
}
}
public MyBitmap(String filePath, String title, String description, String photographer) : base(filePath)
{
this.title = title;
this.description = description;
this.photographer = photographer;
}
}
Upvotes: 1
Views: 230
Reputation: 43876
The reason for your error is that System.Drawing.Bitmap
is a sealed class.
So you are not allowed to inherit from Bitmap
at all. Check your compiler error messages, you should have received an error CS0509
.
Upvotes: 7