Virtual Classes

  • Thread starter Thread starter Guest
  • Start date Start date
A class must be declared abstract if it contains at least one virtual
method.
Do not confuse one with each other.
 
In C#, when writing a new class, you can only specify a single class
to inherit from. You can inherit from mulitple interfaces, but only a
single class.
 
Patty O'Dors said:
What's the actual *point* in multiple inheritance, I must ask?

The point to create a class that has more than one parent. Like you are
derived from your mother and your father.
It seems like a class in C# can derive from more than one class, so am I
missing something?

No it can't (not directly). A class can only have one base class, (and
implement any number of interfaces).
Of course the base class can have another base class as well, but that's not
multiple inheritance.
Is it the difference between deriving from one then the other, and both at
once?

Like in the mother&father example: The point is that you can derive from two
unrelated classes.

For example, in C# you can't a class that's derived from ArrayList and
UserControl at the same time. You would need mutliple inheritance for that.

Niki
 
cody said:
A class must be declared abstract if it contains at least one virtual
method.
Do not confuse one with each other.

I'm afraid you are confusing *abstract* methods and virtual methods.
 
Back
Top