Re: Inherited class

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Kevin Spencer (kevin_at_DIESPAMMERSDIEtakempis.com)
Date: 01/18/05


Date: Tue, 18 Jan 2005 12:25:23 -0500

C# syntax:
public class foo
{
    public int i;
}

public class bar : foo
{
    public int x;
}

VB.Net syntax:
Public Class foo
    Public Integer i
End Class

Public Class bar
    Inherits foo
    Public int x
End Class

In this example, the class foo has one field, and integer named "i". The
class bar inherits foo, so it also has a field named "i." In addition, it
defines a field named "x."

So, you can use all of the (public or protected) properties, fields, and
methods of the foo class in the bar class. You can also use the additional
properties of the bar class in the bar class, but not in the foo class.

Pretty straightforward, eh?

-- 
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"Franck Diastein" <fdiastein@euskaltel.net> wrote in message 
news:eq51F3X$EHA.2984@TK2MSFTNGP09.phx.gbl...
> Do you have some code/site to point me to ?
>
> It's what I'm trying to do with no success...
>
> TIA
>
> Kevin Spencer wrote:
>>>Do you know how can I extend normal DataGrid's behaviour with a class ?
>>
>>
>> Create a class. Inherit DataGrid. Extend it.
>> 


Relevant Pages

  • Re: NOOB QUESTION: How can I access an element in nested classes
    ... function ChangeA() does not work because 'a' doesn't belong to Bar; ... belongs to Foo. ... class Bar change an element that belongs to Foo? ... public void DoSomethingWithBar() ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [Q] best way to inject new functionality into a class
    ... module Foo ... class Bar ... Intro to Ruby on Rails January 12-15 Fort Lauderdale, ...
    (comp.lang.ruby)
  • Re: accessor/mutator - design flaw
    ... > nonetheless I've been advised that multiple uses of accessor/mutator ... > consider the class BAR which has a member data in_use that FOO ... Similarily FOO has member data 'idx' that BAR ...
    (comp.lang.cpp)
  • Re: override verses hide
    ... public void Quux() ... class Bar: Foo ... Foo f = new Bar(); ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Friend a good idea here?
    ... > class Foo ... to put it in a common function and call it in both constructors. ... > The other question is about the use of friend in general here. ...
    (comp.lang.cpp)