Re: OOP 101 - Inheritance confusion
From: ilPostino (news_at_ip80.com)
Date: 03/19/04
- Next message: Jared Parsons [MSFT]: "Re: how to write this program"
- Previous message: ilPostino: "Re: Custom Cursors when dragging and dropping"
- In reply to: ilPostino: "Re: OOP 101 - Inheritance confusion"
- Next in thread: Roy Fine: "Re: OOP 101 - Inheritance confusion"
- Reply: Roy Fine: "Re: OOP 101 - Inheritance confusion"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 19 Mar 2004 14:32:37 -0500
let me take my foot out my mouth -
correction to below: if you want to stop a class from being instantiated use
abstract! not inherited
"ilPostino" <news@ip80.com> wrote in message
news:OaAFwfeDEHA.2932@tk2msftngp13.phx.gbl...
> Stop thinking about Abstract and Interface in the same context. They are
> used for different things.
>
> If you want to stop a class from being inherited use an abstract class.
> Pretend you know nothing about interfaces and never
> use that keyword again ;)
>
> -ilPostino
>
>
>
> "TomB" <shuckle@hotmailXXX.com> wrote in message
> news:OPCJA3cDEHA.2628@TK2MSFTNGP11.phx.gbl...
> > OK.
> > An interface has NO implementation code and everything MUST be
overriden.
> > Correct?
> > Whereas an abstract can have implementation code, can be overriden, and
> > can't be instantiated.
> >
> > Jeez, I thought I head around all this stuff.
> >
> > TomB
> >
> > "David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
> > message news:e0WiKscDEHA.2932@tk2msftngp13.phx.gbl...
> > >
> > > "TomB" <shuckle@hotmailXXX.com> wrote in message
> > > news:uFObcncDEHA.1544@TK2MSFTNGP09.phx.gbl...
> > > > I'm sure this is OOP 101 but I'm confused.
> > > >
> > > > I'm writing a simple accounting type application. I created an
> abstract
> > > > class called IAccount, which my other account types are derived
from.
> > >
> > > IAccount would be an interface. You just want an abstract class.
> Abstract
> > > simply means that it cannot be instantiated directly.
> > >
> > > abstract class Account
> > > {
> > > protected Decimal balance;
> > > public Decimal Debit(Decimal Amount)
> > > {
> > > balance -= Amount;
> > > return balance;
> > > }
> > > }
> > >
> > > class DDAAccount : Account
> > > {
> > > protected string accountNumber;
> > > DDAAccount(string AccountNumber)
> > > {
> > > accountNumber = AccountNumber;
> > > balance = 0;
> > > }
> > > }
> > >
> > > David
> > >
> > >
> >
> >
>
>
- Next message: Jared Parsons [MSFT]: "Re: how to write this program"
- Previous message: ilPostino: "Re: Custom Cursors when dragging and dropping"
- In reply to: ilPostino: "Re: OOP 101 - Inheritance confusion"
- Next in thread: Roy Fine: "Re: OOP 101 - Inheritance confusion"
- Reply: Roy Fine: "Re: OOP 101 - Inheritance confusion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|