473,903 Members | 3,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Collecti ons.CollectionB ase, 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 "LinearNavigato r" 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 2176
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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a generic manager forForward and Back operations (like IE) that is inherited to provideinteraction with specific types (like inheriting CollectionBase) .LinearNavigato r 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.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a

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

to provide
interaction with specific types (like inheriting

CollectionBase) .
LinearNavigato r 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/
vbconabstractcl assesversusinte rfaces.asp

Found a link to the abstract class vs interface question :D
"Jack Meyhoff" <po********@127 .0.0.3> wrote in message
news:O3******** ******@TK2MSFTN GP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica
versa?
"mk" <mk@nospam.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a

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

to provide
interaction with specific types (like inheriting

CollectionBase) .
LinearNavigato r 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.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a

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

to provide
>interaction with specific types (like inheriting

CollectionBase) .
>LinearNavigato r 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.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a

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

CollectionBase) .
>LinearNavigato r 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******** ******@TK2MSFTN GP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica
versa?
"mk" <mk@nospam.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a

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

to provide
interaction with specific types (like inheriting

CollectionBase) .
LinearNavigato r 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.Collecti ons.CollectionB ase
{
public Class1()
{
}
public static void Main()
{
Class1 class1 = new Class1();
}
}

--mike

"Noah Coad [MVP .NET/C#]" <no**@coad.ne t> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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******** ******@TK2MSFTN GP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica versa?
"mk" <mk@nospam.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a
generic manager for
>Forward and Back operations (like IE) that is inherited
to provide
>interaction with specific types (like inheriting
CollectionBase) .
>LinearNavigato r 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*****@charte r.net> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.Collecti ons.CollectionB ase
{
public Class1()
{
}
public static void Main()
{
Class1 class1 = new Class1();
}
}

--mike

"Noah Coad [MVP .NET/C#]" <no**@coad.ne t> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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******** ******@TK2MSFTN GP09.phx.gbl...
So,where would it best to use an Interface over an abstract class and vica versa?
"mk" <mk@nospam.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a
> generic manager for
> >Forward and Back operations (like IE) that is inherited
> to provide
> >interaction with specific types (like inheriting
> CollectionBase) .
> >LinearNavigato r 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++)

{

SuppliedInDeriv ed(i);

}

}

public abstract void SuppliedInDeriv ed(int i);

}

public class ADerivative : ParentClass

{

public override void SuppliedInDeriv ed(int i)

{

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

}

}

}

"Noah Coad [MVP .NET/C#]" <no**@coad.ne t> wrote in message
news:OA******** *****@tk2msftng p13.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*****@charte r.net> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.Collecti ons.CollectionB ase
{
public Class1()
{
}
public static void Main()
{
Class1 class1 = new Class1();
}
}

--mike

"Noah Coad [MVP .NET/C#]" <no**@coad.ne t> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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******** ******@TK2MSFTN GP09.phx.gbl...
> So,where would it best to use an Interface over an abstract class

and vica
> versa?
>
>
> "mk" <mk@nospam.co m> 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.Collect ions.Collection Base, 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 "LinearNavigato r" which is a
> > generic manager for
> > >Forward and Back operations (like IE) that is inherited
> > to provide
> > >interaction with specific types (like inheriting
> > CollectionBase) .
> > >LinearNavigato r 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

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

Similar topics

8
4609
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: VarArray::funct were an extern, but it is declared in the same file (q.v.). What is the remedy for this? =================
4
2274
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
1882
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 class Base) of the createInstance function below that produces the output: Output:
7
1933
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
4418
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 same invocation from a DistantlyRelated class. What actually happened was that the compiler produced: error C2247: 'A::function' not accessible because 'CloselyRelated' uses 'private' to inherit from 'A' I'm guessing that the above compiler...
3
5486
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. (You must have a <% Register %> so it will see it) You will get TWO warnings per class like:
3
6605
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 &qr, Q3Canvas *canvas); Mosfet::~Mosfet();
52
10031
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 2005, and, since he already has licenses for Office Pro 2002, he wants to upgrade to that. I've been saying that we need to upgrade to Access 2003, not 2002, even if Office is kept at 2002. We are also looking to do a fair amount of...
10
32228
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: ----------------------------------------------------------------------------------- //person.h class Person {
0
9847
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10873
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9684
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4308
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3324
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.