Click here to Skip to main content
15,918,808 members
Home / Discussions / C#
   

C#

 
GeneralRe: call by reference Pin
N a v a n e e t h18-Oct-07 21:22
N a v a n e e t h18-Oct-07 21:22 
GeneralRe: call by reference Pin
kabutar18-Oct-07 21:06
kabutar18-Oct-07 21:06 
AnswerRe: call by reference Pin
Malcolm Smart18-Oct-07 21:12
Malcolm Smart18-Oct-07 21:12 
QuestionHow to configure to OpenOffice through C# Pin
pashitech18-Oct-07 19:15
pashitech18-Oct-07 19:15 
QuestionHow to set entry point for an class [modified] Pin
Exelioindia18-Oct-07 19:11
Exelioindia18-Oct-07 19:11 
AnswerRe: How to set entry point for an class Pin
N a v a n e e t h18-Oct-07 19:26
N a v a n e e t h18-Oct-07 19:26 
Questionclasses inheritance Pin
kabutar18-Oct-07 18:54
kabutar18-Oct-07 18:54 
AnswerRe: classes inheritance Pin
N a v a n e e t h18-Oct-07 19:24
N a v a n e e t h18-Oct-07 19:24 
kabutar wrote:
so how does this statement work:: Animal a1 = new Dog();


Why don't you write a program and experiment this ?

well, see the following code

class Animal
{
	public virtual void ShowAnimal()
	{
		Console.WriteLine("From animal");
	}
}

class Dog : Animal
{
	public override void ShowAnimal()
	{
		Console.WriteLine("From dog");
	}
}

I am initializing the class as you said

Animal a = new Dog();
a.ShowAnimal();

What will be the output ? This will print "From dog". Your object 'a' looks like Animal, but instantiated with Dog. So obviously it will call the overridden method in Dog class. Now remove the overide keyword in Dog class. It will be like
public void ShowAnimal()
{
	Console.WriteLine("From dog");
}

Now run the application and you will find that it called base class function. Because the object looks like Animal, and instance don't have a method that has relation with Animal. Because child method with the same name without keyword oevrride will be considered as a new method. So it will execute base class method.

XMLDocument class having a Save() method which accepts a Stream object. Instead of this, we can pass MemoryStream object which is a child class of stream. So it will call MemoryStream classes methods.

Hope things are clear now. Let me know if it helped


GeneralRe: classes inheritance Pin
kabutar18-Oct-07 19:38
kabutar18-Oct-07 19:38 
GeneralRe: classes inheritance Pin
N a v a n e e t h18-Oct-07 19:50
N a v a n e e t h18-Oct-07 19:50 
GeneralRe: classes inheritance Pin
Malcolm Smart18-Oct-07 21:23
Malcolm Smart18-Oct-07 21:23 
QuestionHow can I drawing over fullscreen ? Pin
Khoramdin18-Oct-07 18:53
Khoramdin18-Oct-07 18:53 
AnswerRe: How can I drawing over fullscreen ? Pin
Luc Pattyn19-Oct-07 3:18
sitebuilderLuc Pattyn19-Oct-07 3:18 
QuestionHTML PARSER problem Pin
netwearcdz118-Oct-07 17:09
netwearcdz118-Oct-07 17:09 
AnswerRe: HTML PARSER problem Pin
N a v a n e e t h18-Oct-07 18:56
N a v a n e e t h18-Oct-07 18:56 
GeneralRe: HTML PARSER problem Pin
netwearcdz119-Oct-07 9:50
netwearcdz119-Oct-07 9:50 
QuestionHow to position controls in panel dynamically? Pin
K a b u k i18-Oct-07 16:44
K a b u k i18-Oct-07 16:44 
AnswerRe: How to position controls in panel dynamically? Pin
K a b u k i18-Oct-07 19:44
K a b u k i18-Oct-07 19:44 
QuestionColumn Totals of a data grid Pin
uppuluripavan18-Oct-07 10:29
uppuluripavan18-Oct-07 10:29 
AnswerRe: Column Totals of a data grid Pin
Malcolm Smart18-Oct-07 21:44
Malcolm Smart18-Oct-07 21:44 
AnswerRe: Column Totals of a data grid Pin
Nouman Bhatti18-Oct-07 22:05
Nouman Bhatti18-Oct-07 22:05 
QuestionCopy Folder Pin
mehrdadc4818-Oct-07 10:11
mehrdadc4818-Oct-07 10:11 
AnswerRe: Copy Folder Pin
TJoe18-Oct-07 10:26
TJoe18-Oct-07 10:26 
QuestionForm Question Pin
MumbleB18-Oct-07 8:15
MumbleB18-Oct-07 8:15 
AnswerRe: Form Question Pin
Judah Gabriel Himango18-Oct-07 8:24
sponsorJudah Gabriel Himango18-Oct-07 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.