473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Member Access When Inheriting

How do you make a member of a class mandatory to override with a _new_
definition? For example, when inheriting from
System.Collections.CollectionBase, you are required to implement certain
methods, such as public void Add(MyClass c).

How can I enforce the same behavior (of requiring to implement a member with
a new return type in an inherited class) in the master class (similar to the
CollectionBase)?

I have a class called "LinearNavigator" which is a generic manager for
Forward and Back operations (like IE) that is inherited to provide
interaction with specific types (like inheriting CollectionBase).
LinearNavigator has methods Next & Back which I want to make mandatory to
implement and a method called Clear that should not be
overridden/re-implemented.

Thanks!
Nov 15 '05 #1
11 2136
mk
Hi,
You need to define LinearNavigator as an abstract class.
You can contain methods and properties as normal, but the
methods for which you wish to enforce implementation,
define them as abstract. Naturally these cannot contain
any implementation in the base class:

The inheriting class must use the override keyword. If
this is omitted, or the implementation is omitted the
compiler reports an error.

For example:

/// Base Class
public abstract class CMostlyAbstract
{
public int x = 1;
public CMostlyAbstract()
{
// TODO: Add constructor logic
}
public abstract void MustOverride();

public void Clear()
{
x=0;
}
}
/// Overriding class
public class COverride : CMostlyAbstract
{
public COverride()
{
// TODO: Add constructor logic
}

public void Reset()
{
base.Clear();
}
public override void MustOverride()
{
// Specific Implementation here!
}
}
/// Usage
COverride co = new COverride();
co.MustOverride();
co.Clear();// Call base method
co.Reset();// call COverride, which calls base
HTH,

Martin
-----Original Message-----
How do you make a member of a class mandatory to override with a _new_definition? For example, when inheriting from
System.Collections.CollectionBase, you are required to implement certainmethods, such as public void Add(MyClass c).

How can I enforce the same behavior (of requiring to implement a member witha new return type in an inherited class) in the master class (similar to theCollectionBase)?

I have a class called "LinearNavigator" which is a generic manager forForward and Back operations (like IE) that is inherited to provideinteraction with specific types (like inheriting CollectionBase).LinearNavigator has methods Next & Back which I want to make mandatory toimplement and a method called Clear that should not be
overridden/re-implemented.

Thanks!
.

Nov 15 '05 #2
So,where would it best to use an Interface over an abstract class and vica
versa?
"mk" <mk@nospam.com> wrote in message
news:00****************************@phx.gbl...
Hi,
You need to define LinearNavigator as an abstract class.
You can contain methods and properties as normal, but the
methods for which you wish to enforce implementation,
define them as abstract. Naturally these cannot contain
any implementation in the base class:

The inheriting class must use the override keyword. If
this is omitted, or the implementation is omitted the
compiler reports an error.

For example:

/// Base Class
public abstract class CMostlyAbstract
{
public int x = 1;
public CMostlyAbstract()
{
// TODO: Add constructor logic
}
public abstract void MustOverride();

public void Clear()
{
x=0;
}
}
/// Overriding class
public class COverride : CMostlyAbstract
{
public COverride()
{
// TODO: Add constructor logic
}

public void Reset()
{
base.Clear();
}
public override void MustOverride()
{
// Specific Implementation here!
}
}
/// Usage
COverride co = new COverride();
co.MustOverride();
co.Clear();// Call base method
co.Reset();// call COverride, which calls base
HTH,

Martin
-----Original Message-----
How do you make a member of a class mandatory to

override with a _new_
definition? For example, when inheriting from
System.Collections.CollectionBase, you are required to

implement certain
methods, such as public void Add(MyClass c).

How can I enforce the same behavior (of requiring to

implement a member with
a new return type in an inherited class) in the master

class (similar to the
CollectionBase)?

I have a class called "LinearNavigator" which is a

generic manager for
Forward and Back operations (like IE) that is inherited

to provide
interaction with specific types (like inheriting

CollectionBase).
LinearNavigator has methods Next & Back which I want to

make mandatory to
implement and a method called Clear that should not be
overridden/re-implemented.

Thanks!
.

Nov 15 '05 #3
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbconabstractclassesversusinterfaces.asp

Found a link to the abstract class vs interface question :D
"Jack Meyhoff" <po********@127.0.0.3> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica
versa?
"mk" <mk@nospam.com> wrote in message
news:00****************************@phx.gbl...
Hi,
You need to define LinearNavigator as an abstract class.
You can contain methods and properties as normal, but the
methods for which you wish to enforce implementation,
define them as abstract. Naturally these cannot contain
any implementation in the base class:

The inheriting class must use the override keyword. If
this is omitted, or the implementation is omitted the
compiler reports an error.

For example:

/// Base Class
public abstract class CMostlyAbstract
{
public int x = 1;
public CMostlyAbstract()
{
// TODO: Add constructor logic
}
public abstract void MustOverride();

public void Clear()
{
x=0;
}
}
/// Overriding class
public class COverride : CMostlyAbstract
{
public COverride()
{
// TODO: Add constructor logic
}

public void Reset()
{
base.Clear();
}
public override void MustOverride()
{
// Specific Implementation here!
}
}
/// Usage
COverride co = new COverride();
co.MustOverride();
co.Clear();// Call base method
co.Reset();// call COverride, which calls base
HTH,

Martin
-----Original Message-----
How do you make a member of a class mandatory to

override with a _new_
definition? For example, when inheriting from
System.Collections.CollectionBase, you are required to

implement certain
methods, such as public void Add(MyClass c).

How can I enforce the same behavior (of requiring to

implement a member with
a new return type in an inherited class) in the master

class (similar to the
CollectionBase)?

I have a class called "LinearNavigator" which is a

generic manager for
Forward and Back operations (like IE) that is inherited

to provide
interaction with specific types (like inheriting

CollectionBase).
LinearNavigator has methods Next & Back which I want to

make mandatory to
implement and a method called Clear that should not be
overridden/re-implemented.

Thanks!
.


Nov 15 '05 #4
This queston was posted just a few days ago, though I'm not sure there
is a definitive answer.

I use iterfaces when I need to perform the same method on disparate,
hierarchically unrelated classes. As an example, I may need to call a
method called Validate on different types of business objects. The
business objects are not related at all, but each need to be validated
before taking some other action. By imherinting an interface called
IValidate, I can call the Validate method on each of these objects
without knowing their real type, by casting each of them to an
IValidate type and calling the method. If the object doesn't implent
the IValidate interface, then I skip the call. These could be objects
contained in an arraylist or other collection type.

I use an abstract class if I want to force an object to implement an
overridden method, but when there are other characteristics that a
class would share with its base class.

Jonathan Schafer
On Sat, 9 Aug 2003 19:16:17 +0200, "Jack Meyhoff"
<po********@127.0.0.3> wrote:
So,where would it best to use an Interface over an abstract class and vica
versa?
"mk" <mk@nospam.com> wrote in message
news:00****************************@phx.gbl...
Hi,
You need to define LinearNavigator as an abstract class.
You can contain methods and properties as normal, but the
methods for which you wish to enforce implementation,
define them as abstract. Naturally these cannot contain
any implementation in the base class:

The inheriting class must use the override keyword. If
this is omitted, or the implementation is omitted the
compiler reports an error.

For example:

/// Base Class
public abstract class CMostlyAbstract
{
public int x = 1;
public CMostlyAbstract()
{
// TODO: Add constructor logic
}
public abstract void MustOverride();

public void Clear()
{
x=0;
}
}
/// Overriding class
public class COverride : CMostlyAbstract
{
public COverride()
{
// TODO: Add constructor logic
}

public void Reset()
{
base.Clear();
}
public override void MustOverride()
{
// Specific Implementation here!
}
}
/// Usage
COverride co = new COverride();
co.MustOverride();
co.Clear();// Call base method
co.Reset();// call COverride, which calls base
HTH,

Martin
>-----Original Message-----
>How do you make a member of a class mandatory to

override with a _new_
>definition? For example, when inheriting from
>System.Collections.CollectionBase, you are required to

implement certain
>methods, such as public void Add(MyClass c).
>
>How can I enforce the same behavior (of requiring to

implement a member with
>a new return type in an inherited class) in the master

class (similar to the
>CollectionBase)?
>
>I have a class called "LinearNavigator" which is a

generic manager for
>Forward and Back operations (like IE) that is inherited

to provide
>interaction with specific types (like inheriting

CollectionBase).
>LinearNavigator has methods Next & Back which I want to

make mandatory to
>implement and a method called Clear that should not be
>overridden/re-implemented.
>
>Thanks!
>
>
>.
>


Nov 15 '05 #5
mk
Hi,
It really depends on what you're trying to achieve,
however an Interface contains no implementation
whatsoever and is commonly used just to define a
contract. For example, if you define an interface in a
separate application, then several applications can
contain classes that implement that foreign interface,
and can pass objects to one another that may be cast to
that interface and the correct methods called against
them.
An interface could not have solved all of Noah's
requirements, because he had a Clear() method that must
be implemented in the base class. However he could have
defined an interface, and inherited that in his base
class. This scenario would have been useful for remoting
or distributed situations, but would not have mattered
much as the key element was providing a base class with
some overridable and some sealed methods rather than
defining an abstract contract.

HTH,

Martin
-----Original Message-----
So,where would it best to use an Interface over an abstract class and vicaversa?
"mk" <mk@nospam.com> wrote in message
news:00****************************@phx.gbl...
Hi,
You need to define LinearNavigator as an abstract class. You can contain methods and properties as normal, but the methods for which you wish to enforce implementation,
define them as abstract. Naturally these cannot contain any implementation in the base class:

The inheriting class must use the override keyword. If
this is omitted, or the implementation is omitted the
compiler reports an error.

For example:

/// Base Class
public abstract class CMostlyAbstract
{
public int x = 1;
public CMostlyAbstract()
{
// TODO: Add constructor logic
}
public abstract void MustOverride();

public void Clear()
{
x=0;
}
}
/// Overriding class
public class COverride : CMostlyAbstract
{
public COverride()
{
// TODO: Add constructor logic
}

public void Reset()
{
base.Clear();
}
public override void MustOverride()
{
// Specific Implementation here!
}
}
/// Usage
COverride co = new COverride();
co.MustOverride();
co.Clear();// Call base method
co.Reset();// call COverride, which calls base
HTH,

Martin
>-----Original Message-----
>How do you make a member of a class mandatory to

override with a _new_
>definition? For example, when inheriting from
>System.Collections.CollectionBase, you are required to

implement certain
>methods, such as public void Add(MyClass c).
>
>How can I enforce the same behavior (of requiring to

implement a member with
>a new return type in an inherited class) in the master

class (similar to the
>CollectionBase)?
>
>I have a class called "LinearNavigator" which is a

generic manager for
>Forward and Back operations (like IE) that is
inherited to provide
>interaction with specific types (like inheriting

CollectionBase).
>LinearNavigator has methods Next & Back which I want
to make mandatory to
>implement and a method called Clear that should not be
>overridden/re-implemented.
>
>Thanks!
>
>
>.
>

.

Nov 15 '05 #6
Okay, this is not what I'm looking for. Maybe an abstract class, but the
members can't be abstract since I do need an application of the method in
the base class.

Just like CollectionBase does implement IList's Add & Remove methods, which
you have to override in an inherited class. But in CollectionBase, you have
to actually cast to IList to get access to the Add & Remove methods.

-Noah

"Jack Meyhoff" <po********@127.0.0.3> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica
versa?
"mk" <mk@nospam.com> wrote in message
news:00****************************@phx.gbl...
Hi,
You need to define LinearNavigator as an abstract class.
You can contain methods and properties as normal, but the
methods for which you wish to enforce implementation,
define them as abstract. Naturally these cannot contain
any implementation in the base class:

The inheriting class must use the override keyword. If
this is omitted, or the implementation is omitted the
compiler reports an error.

For example:

/// Base Class
public abstract class CMostlyAbstract
{
public int x = 1;
public CMostlyAbstract()
{
// TODO: Add constructor logic
}
public abstract void MustOverride();

public void Clear()
{
x=0;
}
}
/// Overriding class
public class COverride : CMostlyAbstract
{
public COverride()
{
// TODO: Add constructor logic
}

public void Reset()
{
base.Clear();
}
public override void MustOverride()
{
// Specific Implementation here!
}
}
/// Usage
COverride co = new COverride();
co.MustOverride();
co.Clear();// Call base method
co.Reset();// call COverride, which calls base
HTH,

Martin
-----Original Message-----
How do you make a member of a class mandatory to

override with a _new_
definition? For example, when inheriting from
System.Collections.CollectionBase, you are required to

implement certain
methods, such as public void Add(MyClass c).

How can I enforce the same behavior (of requiring to

implement a member with
a new return type in an inherited class) in the master

class (similar to the
CollectionBase)?

I have a class called "LinearNavigator" which is a

generic manager for
Forward and Back operations (like IE) that is inherited

to provide
interaction with specific types (like inheriting

CollectionBase).
LinearNavigator has methods Next & Back which I want to

make mandatory to
implement and a method called Clear that should not be
overridden/re-implemented.

Thanks!
.


Nov 15 '05 #7
I don't think I'm understanding something...
Do you just mean explicit interface implementation? That's what
CollectionBase uses for IList (as you mentioned, you have to cast
CollectionBase to an IList to use it).

But in what way do you have to override ILists's Add & Remove in
CollectionBase. This compiles just fine (doesn't do much, granted).

class Class1 : System.Collections.CollectionBase
{
public Class1()
{
}
public static void Main()
{
Class1 class1 = new Class1();
}
}

--mike

"Noah Coad [MVP .NET/C#]" <no**@coad.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Okay, this is not what I'm looking for. Maybe an abstract class, but the members can't be abstract since I do need an application of the method in the base class.

Just like CollectionBase does implement IList's Add & Remove methods, which you have to override in an inherited class. But in CollectionBase, you have to actually cast to IList to get access to the Add & Remove methods.

-Noah

"Jack Meyhoff" <po********@127.0.0.3> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica versa?
"mk" <mk@nospam.com> wrote in message
news:00****************************@phx.gbl...
Hi,
You need to define LinearNavigator as an abstract class.
You can contain methods and properties as normal, but the
methods for which you wish to enforce implementation,
define them as abstract. Naturally these cannot contain
any implementation in the base class:

The inheriting class must use the override keyword. If
this is omitted, or the implementation is omitted the
compiler reports an error.

For example:

/// Base Class
public abstract class CMostlyAbstract
{
public int x = 1;
public CMostlyAbstract()
{
// TODO: Add constructor logic
}
public abstract void MustOverride();

public void Clear()
{
x=0;
}
}
/// Overriding class
public class COverride : CMostlyAbstract
{
public COverride()
{
// TODO: Add constructor logic
}

public void Reset()
{
base.Clear();
}
public override void MustOverride()
{
// Specific Implementation here!
}
}
/// Usage
COverride co = new COverride();
co.MustOverride();
co.Clear();// Call base method
co.Reset();// call COverride, which calls base
HTH,

Martin

>-----Original Message-----
>How do you make a member of a class mandatory to
override with a _new_
>definition? For example, when inheriting from
>System.Collections.CollectionBase, you are required to
implement certain
>methods, such as public void Add(MyClass c).
>
>How can I enforce the same behavior (of requiring to
implement a member with
>a new return type in an inherited class) in the master
class (similar to the
>CollectionBase)?
>
>I have a class called "LinearNavigator" which is a
generic manager for
>Forward and Back operations (like IE) that is inherited
to provide
>interaction with specific types (like inheriting
CollectionBase).
>LinearNavigator has methods Next & Back which I want to
make mandatory to
>implement and a method called Clear that should not be
>overridden/re-implemented.
>
>Thanks!
>
>
>.
>



Nov 15 '05 #8
Okay, well when defining your own implementation of Add & Remove, the 'new'
or 'override' keyword is not nessasary. How is this accomplished?

-Noah
"Michael Mayer" <mr*****@charter.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I don't think I'm understanding something...
Do you just mean explicit interface implementation? That's what
CollectionBase uses for IList (as you mentioned, you have to cast
CollectionBase to an IList to use it).

But in what way do you have to override ILists's Add & Remove in
CollectionBase. This compiles just fine (doesn't do much, granted).

class Class1 : System.Collections.CollectionBase
{
public Class1()
{
}
public static void Main()
{
Class1 class1 = new Class1();
}
}

--mike

"Noah Coad [MVP .NET/C#]" <no**@coad.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Okay, this is not what I'm looking for. Maybe an abstract class,

but the
members can't be abstract since I do need an application of the

method in
the base class.

Just like CollectionBase does implement IList's Add & Remove

methods, which
you have to override in an inherited class. But in CollectionBase,

you have
to actually cast to IList to get access to the Add & Remove methods.

-Noah

"Jack Meyhoff" <po********@127.0.0.3> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica versa?
"mk" <mk@nospam.com> wrote in message
news:00****************************@phx.gbl...
> Hi,
> You need to define LinearNavigator as an abstract class.
> You can contain methods and properties as normal, but the
> methods for which you wish to enforce implementation,
> define them as abstract. Naturally these cannot contain
> any implementation in the base class:
>
> The inheriting class must use the override keyword. If
> this is omitted, or the implementation is omitted the
> compiler reports an error.
>
> For example:
>
> /// Base Class
> public abstract class CMostlyAbstract
> {
> public int x = 1;
> public CMostlyAbstract()
> {
> // TODO: Add constructor logic
> }
> public abstract void MustOverride();
>
> public void Clear()
> {
> x=0;
> }
> }
> /// Overriding class
> public class COverride : CMostlyAbstract
> {
> public COverride()
> {
> // TODO: Add constructor logic
> }
>
> public void Reset()
> {
> base.Clear();
> }
> public override void MustOverride()
> {
> // Specific Implementation here!
> }
> }
> /// Usage
> COverride co = new COverride();
> co.MustOverride();
> co.Clear();// Call base method
> co.Reset();// call COverride, which calls base
>
>
> HTH,
>
> Martin
>
> >-----Original Message-----
> >How do you make a member of a class mandatory to
> override with a _new_
> >definition? For example, when inheriting from
> >System.Collections.CollectionBase, you are required to
> implement certain
> >methods, such as public void Add(MyClass c).
> >
> >How can I enforce the same behavior (of requiring to
> implement a member with
> >a new return type in an inherited class) in the master
> class (similar to the
> >CollectionBase)?
> >
> >I have a class called "LinearNavigator" which is a
> generic manager for
> >Forward and Back operations (like IE) that is inherited
> to provide
> >interaction with specific types (like inheriting
> CollectionBase).
> >LinearNavigator has methods Next & Back which I want to
> make mandatory to
> >implement and a method called Clear that should not be
> >overridden/re-implemented.
> >
> >Thanks!
> >
> >
> >.
> >



Nov 15 '05 #9
Maybe the Stragegy Design Pattern is what you really need?

This allows you to provide an algorithm in an abstract base class which
calls abstract methods.

Derivatives supply the implementation of the methods that get called in the
base class' algorithm.

For example (bastardized):

using System;
namespace TestApp

{

class MainClass

{

[STAThread]

static void Main(string[] args)

{

ParentClass p = new ADerivative();

p.DoSomething();

Console.Read();

}

}

public abstract class ParentClass

{
public void DoSomething()

{

for (int i=0;i<100;i++)

{

SuppliedInDerived(i);

}

}

public abstract void SuppliedInDerived(int i);

}

public class ADerivative : ParentClass

{

public override void SuppliedInDerived(int i)

{

Console.WriteLine("this example sucks: " + i);

}

}

}

"Noah Coad [MVP .NET/C#]" <no**@coad.net> wrote in message
news:OA*************@tk2msftngp13.phx.gbl...
Okay, well when defining your own implementation of Add & Remove, the 'new' or 'override' keyword is not nessasary. How is this accomplished?

-Noah
"Michael Mayer" <mr*****@charter.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I don't think I'm understanding something...
Do you just mean explicit interface implementation? That's what
CollectionBase uses for IList (as you mentioned, you have to cast
CollectionBase to an IList to use it).

But in what way do you have to override ILists's Add & Remove in
CollectionBase. This compiles just fine (doesn't do much, granted).

class Class1 : System.Collections.CollectionBase
{
public Class1()
{
}
public static void Main()
{
Class1 class1 = new Class1();
}
}

--mike

"Noah Coad [MVP .NET/C#]" <no**@coad.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Okay, this is not what I'm looking for. Maybe an abstract class,

but the
members can't be abstract since I do need an application of the

method in
the base class.

Just like CollectionBase does implement IList's Add & Remove

methods, which
you have to override in an inherited class. But in CollectionBase,

you have
to actually cast to IList to get access to the Add & Remove methods.

-Noah

"Jack Meyhoff" <po********@127.0.0.3> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
> So,where would it best to use an Interface over an abstract class

and vica
> versa?
>
>
> "mk" <mk@nospam.com> wrote in message
> news:00****************************@phx.gbl...
> > Hi,
> > You need to define LinearNavigator as an abstract class.
> > You can contain methods and properties as normal, but the
> > methods for which you wish to enforce implementation,
> > define them as abstract. Naturally these cannot contain
> > any implementation in the base class:
> >
> > The inheriting class must use the override keyword. If
> > this is omitted, or the implementation is omitted the
> > compiler reports an error.
> >
> > For example:
> >
> > /// Base Class
> > public abstract class CMostlyAbstract
> > {
> > public int x = 1;
> > public CMostlyAbstract()
> > {
> > // TODO: Add constructor logic
> > }
> > public abstract void MustOverride();
> >
> > public void Clear()
> > {
> > x=0;
> > }
> > }
> > /// Overriding class
> > public class COverride : CMostlyAbstract
> > {
> > public COverride()
> > {
> > // TODO: Add constructor logic
> > }
> >
> > public void Reset()
> > {
> > base.Clear();
> > }
> > public override void MustOverride()
> > {
> > // Specific Implementation here!
> > }
> > }
> > /// Usage
> > COverride co = new COverride();
> > co.MustOverride();
> > co.Clear();// Call base method
> > co.Reset();// call COverride, which calls base
> >
> >
> > HTH,
> >
> > Martin
> >
> > >-----Original Message-----
> > >How do you make a member of a class mandatory to
> > override with a _new_
> > >definition? For example, when inheriting from
> > >System.Collections.CollectionBase, you are required to
> > implement certain
> > >methods, such as public void Add(MyClass c).
> > >
> > >How can I enforce the same behavior (of requiring to
> > implement a member with
> > >a new return type in an inherited class) in the master
> > class (similar to the
> > >CollectionBase)?
> > >
> > >I have a class called "LinearNavigator" which is a
> > generic manager for
> > >Forward and Back operations (like IE) that is inherited
> > to provide
> > >interaction with specific types (like inheriting
> > CollectionBase).
> > >LinearNavigator has methods Next & Back which I want to
> > make mandatory to
> > >implement and a method called Clear that should not be
> > >overridden/re-implemented.
> > >
> > >Thanks!
> > >
> > >
> > >.
> > >
>
>



Nov 15 '05 #10
CollectionBase is an abstract class. It cannot even be instantiated.
CollectionBase also happens to implements IList.

You can recreate this behavior in your object model too.

You can also have a derived class call its base class's methods, as well as
override them (or neither). You can even shadow the base classes in derived
classes, also this is not recommended.

I think all the flexibility you need is there. But perhaps I am missing
something in the original question. Maybe you wouldn't mind restating it
with a code sketch example to make it crystal clear what you want?
Nov 15 '05 #11
Thanks for all your help and information. I haven't found quite what I'm
looking for yet and this thread is getting old, so I'll reconsider my
question, try to study and learn some more, and repost it more propperly
stated at a later time. Thanks once again!

-Noah
"mia lanui" <mi**@email.com> wrote in message
news:2C*****************@nwrdny02.gnilink.net...
I am getting tired, I meant to write "shadow the base class's methods in the derived classes, although this is not recommended"

"mia lanui" <mi**@email.com> wrote in message
news:sA*****************@nwrdny02.gnilink.net...
CollectionBase is an abstract class. It cannot even be instantiated.
CollectionBase also happens to implements IList.

You can recreate this behavior in your object model too.

You can also have a derived class call its base class's methods, as well

as
override them (or neither). You can even shadow the base classes in

derived
classes, also this is not recommended.

I think all the flexibility you need is there. But perhaps I am missing
something in the original question. Maybe you wouldn't mind restating it
with a code sketch example to make it crystal clear what you want?


Nov 15 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
4
by: Ian Malone | last post by:
I have a class which looks like this: class reco { public: int height, width; double beta; double mu; simple_d_field estimate; simple_d_field auxiliary;
6
by: Querejeto | last post by:
Hello: Is it possible to detect programmatically the constness of a member function when it is called? That is, I would like to see a generic implementation (i.e. it does not depend on the...
7
by: alex.mizrahi | last post by:
helo i'm going to use pointers to member function with virtual inheritance in following way: struct base { public: typedef void (base::*fun_t)(void); int i; void call(fun_t f) {
6
by: Bill Rubin | last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the...
3
by: Wayne Brantley | last post by:
VS2005 RTM Create a web user control to use as a base class for other web user controls. Now, create a new web user control, change the class it inherits from to your base class and compile....
3
by: Jeff | last post by:
Its been years since I did C++ and Im unsure what this is about. I have a QT class Im inheriting from in my .h file: class Mosfet : Q3CanvasRectangle { public: Mosfet::Mosfet(const QRect...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
10
by: shanknbake | last post by:
I'm getting the following compile-time error: error C2352: 'Person::getCount' : illegal call of non-static member function Here is my getCount function declaration:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.