|
hai there,
i have a base class and a derived class. A < B.
both classes have a method of same signature and same name.
if i call that method on my derived class the base class method will execute. what is the actual tecnical side behind this ?. if i want to execute the derived class method then what i want to do ?
What is the difference between multi level and multiple inheritance ?
how can i impliemnt multilevel inheritance in C#.
need detailed description. other wise show me some usefull links
Sreejith S S Nair
|
|
|
|
|
To achieve what you're saying, declare the method on the base class as 'virtual' and the method on the derived class as 'override'.
Due to technical difficulties my previous signature, "I see dumb people" will be off until further notice. Too many people were thinking I was talking about them...
|
|
|
|
|
hi,
Answer to your first question :
class A
{
public virtual void Display()
{
// I'm in the base class
}
}
class B : A
{
public override void Display()
{
// I'm in the derived class
}
}
the notable thing in this piece of code is the use of the word "override". This example demonstrates the polymorphic behaviour. If "Display()" is called from an object of class B the overridden display of class B will be called. Where as if the same function is called from the object of class A then the base class Display will be called.
Internally this is done by maintaining a virtual pointer table. Whenever user tries to call the Disply method thru the derived class object the CLR looks at the VPTR table and determines which Display method to call and resolves the same...
Answer to your second Question :
Assume a class hierarchy :
Living_Organism
|
Mammal Insect
|
Boy Girl
Now in this heirarchy the class Boy is indirectly inherited from the top level class "Living_Organism" thus this is a multilevel inheritence.
But if you derive a class from two classes at the same time then it is called multiple inheritence. For example
class IceCream : Milk,Food
{
}
class IceCream demonstrates multiple inheritence because it is derived from more then one class (Milk and Food).
Note : Multiple inheritence is not allowed directly in C#. But you can simulate it upto some extent by inheriting a class from another class and an interface.
class Test : Name ,IAge
{
}
the class Test is derived from a class "Name" and an interface "IAge".
You can know more about all these from the following link...
http://www.windowsitlibrary.com/Content/1040/05/1.html
Hope this answers your query...
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Hi Guys,
I have data retrieved from diff ports using sockect connections. I got all the data inserted into SQL server database. I need to display the information exactly the same it was saved from my DB using datagrid. It was OK, it was display the data. What I need is if there is an ascii value like for example "Next Line" between each sentence the following sentence will should be displayed on the next like. What is happening now is that it's just display the data with one continuous line.
Ideas or link will do but if you could help the better. Please....
/dabuskol
|
|
|
|
|
You'll need to derive your own DataGridColumnStyle to acheive this. While the DataGridTextBoxColumn does use a TextBox internally to edit data (and you can set properties to make happen what you want), the text is painted as is. You need to change the painting so that certain characters are painted a certain way or induce line changes, like a CR or LR (or a CRLF pair).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hai there,
Sreejith S S Nair
|
|
|
|
|
Dear Sir/Madam,
I'am trying to rotate an image in a picture box control in C#.Along with that i'am drawing a rectangle on to the image for highlighting certain parts of the image.While rotating the image is getting rotated properly but the drawing which i have made on the image is not getting rotated.I have tried with rotate and rotateat methods but they just rotate the drawing but not with respect to the image.
My requirement is that while i'am rotating the image, the drawn rectangle highlighting certain parts also should get rotated and highlight the very same area in the rotated form.
Kindly help me,
Regards,
mmx
|
|
|
|
|
|
Drawing on the image is not the issue...That is done using the graphics object only...But while the image is rotated the drawings position is not changed or rotated.It lies in the same place...while image is rotated...
Also while creating graphics from image an exception is popping 'coz it is saying "creating graphics object from image that has indexed pixel format is not possible "
I need some mapping modes equivalent to MM_HIENGLISH,MM_HIMETRIC in VC++ in C#.NET...Also help me a bit with code...
Kindly help me out Barry...
Regards,
MMX
|
|
|
|
|
A quick search for "image rotation" on CodeProject turns up several articles, including a pretty good one, Image Rotation in .NET[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am faced with a problem and dont know where to begin. I am required to write a bot (automated program) in C# (preferably). Right now we have a website where a user has to enter some information and depending upon the options selected, a number representing that particular client with the options selected is generated and given back.
This website is working perfectly fine. But now what we want to do is instead of entering all the inforamtion again and again everytime we want to generate that number, we want to automate it. That is, write a class which will get the inforamtion from the database and accesses the already existing website, provide it with all the information and get the number generated.
The details of the existing website are as follows:
1. It is a form based website.
2. It has two web pages. i.e., on the fist page after entering the information and submitting it, the next page comes up and after entering the information on this one and submitting it will generate the required number.
3. Both these pages are passwrord protected. i.e., have to provide a user name and password before accessing them.
I am really confused how to begin and where to begin. I am not even sure if something like this can be done? Any help would be greatly appreciated.
Thanks in advance
Kashif
|
|
|
|
|
Filling the web page with information is pointless - just post the data yourself using a HttpWebRequest and using the GetRequestStream method, which - if you look at the documentation for that method in the .NET Framework SDK - includes an example. You can also use the WebClient.UploadData for this, but you don't have quit as much control over the HTTP headers that are sent.
As far as pulling information from a database, that's easy. Use ADO.NET. See the System.Data namespace in the .NET Framework SDK, and use whichever child namespaces (like System.Data.SqlClient for SQL Server or System.Data.OleDb for any data source with an OLE DB provider). There is plenty of examples in the class library documentation for members of those namespaces and you can always ask this forum if you have specific questions.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Mr.Heath Stewart
I use the way that you describe for me .
this way only safe for graphic based on Win App.
but when i use from that file generated in web, black color appear in background.
i will make transparent background area (alpha channel)
if you know how i can resolve this problem , please describe for me .
thank's
---------------
Bitmap b = new Bitmap(100,20);<br />
Graphics g = Graphics.FromImage(b);<br />
g.Clear(Color.Orange);<br />
g.DrawString("Test",new Font("Tahoma",8),new SolidBrush(Color.Green),0,0);<br />
b.MakeTransparent(Color.Orange);<br />
b.Save("test.gif",System.Drawing.Imaging.ImageFormat.Gif);<br />
|
|
|
|
|
There is a bug in the .NET Framework when it comes to transparency. Head over to dotnet247 for lots of info on this plus some complicated workarounds.
regards,
Paul Watson
Bluegrass
South Africa
Chris Maunder wrote:
"I'd rather cover myself in honey and lie on an ant's nest than commit myself to it publicly."
Jon Sagara replied:
"I think we've all been in that situation before."
Crikey! ain't life grand?
|
|
|
|
|
ON top of that, .GIF files don't support an alpha channel. Just a transparency key...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
...which is what I told him.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I know! Sometime you just need a bigger hammer to drive the point home! Like making TABs in VS.NET...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi! anybody can assist me in developing a simple blob analysis program via C# -GDI+. The idea is I would want to do some image processing on a captured images (in this example, it'll be few coins). The picture of these coins are taken via digital camera. I would really much appreciate it somebody can help me in the blob analysis program.
M
|
|
|
|
|
I have a class that I access from my main form to get all my class data. I created a thread to do a particular task (first time using threads), only it seems to have a new instantiation of my class, and all the class data is off. How can I get these two synchronized so that my thread can access the same data my form gets?
|
|
|
|
|
Post the code that spawns the work thread, assuming that this work thread is used to read in data or whatever and set a form's data member in the main thread.
In general, read in the data in the work thread. Invocate an event to update the main thread.
Kuphryn
|
|
|
|
|
Heres what the code looks like:
static void Main()
{
//making a new instance of this class to run outside of main
Form1 f = new Form1();
f.startScheduler();
Application.Run(new Form1());
}
public void startScheduler()
{
//get this thread goin
Thread t1 = new Thread(new ThreadStart(ripper));
t1.Start();
}
public void ripper()
{
//infinite loop
for ( ;;)
{
if (hc.getNumThemes() >= 1)
{
MessageBox.Show("calling riptheme");
hc.rip_Theme();
}
Thread.Sleep(4000);
}
}
during the application, hc.getNumThemes gets bumped from 0 to 1,2,3. But the thread always remains at 0.
|
|
|
|
|
Dear CPians,
I am in need of customized PropertyGrid component(.NET Compatable) with look and feel like the link below
http://www.visualhint.com/propertygrid.php
If you know any of such controls, Please let me know.
I would appreciate your help in this regard.
Thanks in advance.
Regards,
Jay.
|
|
|
|
|
As I mentioned to you before[^], you can use either the IL Disassembler (ildasm.exe that comes with the .NET Framework SDK) or a decompiler to find out how the PropertyGrid works. I also told you how it uses the System.ComponentModel namespace members to provide it with functionality (which leppie also mentioned), which is what that namespace (and a few related namespaces) are for. The .NET FCL provides a designer with almost everything it needs to design components.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|