473,403 Members | 2,270 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,403 software developers and data experts.

Inheriting a base class - Invalid Cast Exception

I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup
table" from my database that contains lists of things like
manufacturers, makes, modes, etc. of cars. I have created a generic
"datacollection" class and a generic "dataobject" class to represent the
table and the rows within that table as a collection of objects with
generic properties for manipulating fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I
have then written subclasses to more specifically use the base class for
a particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from
DataObject. So, back to my problem. In the item method, the generic
DataCollection class requires a "Key" that will be used for the lookup.
It then searches its internal data table and returns the appropriate
DataObject object. However, what I WANT, is to create an overriding Item
object in my Manufacturers object that returns a MANUFACTURER instead of
a DATAOBJECT. So I created a Public Shadows property that returns a
Manufacturer object but callse the MyBase.Item function to get it. But
MyBase.Item returns a DataObject, not a objManufactuer, and then I get
thrown my Invalid Cast Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

..

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String)
as objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

..

End Class


Nov 21 '05 #1
10 2738
by using shadows, you are breaking polymorphism. Is there a reason you cant
use overrides?
"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...
I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup table"
from my database that contains lists of things like manufacturers, makes,
modes, etc. of cars. I have created a generic "datacollection" class and a
generic "dataobject" class to represent the table and the rows within that
table as a collection of objects with generic properties for manipulating
fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I have
then written subclasses to more specifically use the base class for a
particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from DataObject.
So, back to my problem. In the item method, the generic DataCollection
class requires a "Key" that will be used for the lookup. It then searches
its internal data table and returns the appropriate DataObject object.
However, what I WANT, is to create an overriding Item object in my
Manufacturers object that returns a MANUFACTURER instead of a DATAOBJECT.
So I created a Public Shadows property that returns a Manufacturer object
but callse the MyBase.Item function to get it. But MyBase.Item returns a
DataObject, not a objManufactuer, and then I get thrown my Invalid Cast
Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

.

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String) as
objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

.

End Class



Nov 21 '05 #2
My previous response doesnt really address your question though. You are
still going to have to CType the result because you are ASKING for a generic
object by asking for it from the base class.
"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...
I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup table"
from my database that contains lists of things like manufacturers, makes,
modes, etc. of cars. I have created a generic "datacollection" class and a
generic "dataobject" class to represent the table and the rows within that
table as a collection of objects with generic properties for manipulating
fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I have
then written subclasses to more specifically use the base class for a
particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from DataObject.
So, back to my problem. In the item method, the generic DataCollection
class requires a "Key" that will be used for the lookup. It then searches
its internal data table and returns the appropriate DataObject object.
However, what I WANT, is to create an overriding Item object in my
Manufacturers object that returns a MANUFACTURER instead of a DATAOBJECT.
So I created a Public Shadows property that returns a Manufacturer object
but callse the MyBase.Item function to get it. But MyBase.Item returns a
DataObject, not a objManufactuer, and then I get thrown my Invalid Cast
Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

.

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String) as
objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

.

End Class



Nov 21 '05 #3
Scratch that, you can't ctype a base class to its derived type. You have to
override the Item property in the derived class and implement it to return
the type you wanted to return. You cant return a speficic type (or more
specifically, cant return several different specific types) from a single
base class.
"Rick Mogstad" <Ri**********@GMail.NOSPAM.com> wrote in message
news:Oa**************@TK2MSFTNGP14.phx.gbl...
My previous response doesnt really address your question though. You are
still going to have to CType the result because you are ASKING for a
generic object by asking for it from the base class.
"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...
I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup table"
from my database that contains lists of things like manufacturers, makes,
modes, etc. of cars. I have created a generic "datacollection" class and a
generic "dataobject" class to represent the table and the rows within that
table as a collection of objects with generic properties for manipulating
fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I
have then written subclasses to more specifically use the base class for
a particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from DataObject.
So, back to my problem. In the item method, the generic DataCollection
class requires a "Key" that will be used for the lookup. It then searches
its internal data table and returns the appropriate DataObject object.
However, what I WANT, is to create an overriding Item object in my
Manufacturers object that returns a MANUFACTURER instead of a DATAOBJECT.
So I created a Public Shadows property that returns a Manufacturer object
but callse the MyBase.Item function to get it. But MyBase.Item returns a
DataObject, not a objManufactuer, and then I get thrown my Invalid Cast
Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

.

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String) as
objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

.

End Class




Nov 21 '05 #4

Write a constructor for objManufacturer that accepts a objDataObject;
then in objManufacturers.Item, do this:

Public Shadows Readonly Property Item(byval Code as String) as
objManufacturer
Get
return New objManufacturer(MyBase.Item(code))
End Get
End Property

Your problem is this (and I agree it might seem non-intuitive): if you
want to specialise an object (ie make a derived-class object from a
base-class object), you must *explicitly* specify how to do it, by
means of an appropriate constructor or otherwise. That is, using the
usual OO example, you CAN'T say

Dim a as Animal = New Animal
Dim d as Dog = a ' nuh uh!

without somewhere saying exactly how you want to make a Dog from an
Animal. It's a similar idea to the way that constructors can't be
inherited - when you specialise you take on the burden of explaining
the specialisation.

Chet Cromer wrote:
I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup
table" from my database that contains lists of things like
manufacturers, makes, modes, etc. of cars. I have created a generic
"datacollection" class and a generic "dataobject" class to represent the
table and the rows within that table as a collection of objects with
generic properties for manipulating fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I
have then written subclasses to more specifically use the base class for
a particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from
DataObject. So, back to my problem. In the item method, the generic
DataCollection class requires a "Key" that will be used for the lookup.
It then searches its internal data table and returns the appropriate
DataObject object. However, what I WANT, is to create an overriding Item
object in my Manufacturers object that returns a MANUFACTURER instead of
a DATAOBJECT. So I created a Public Shadows property that returns a
Manufacturer object but callse the MyBase.Item function to get it. But
MyBase.Item returns a DataObject, not a objManufactuer, and then I get
thrown my Invalid Cast Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

.

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String)
as objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

.

End Class


Nov 21 '05 #5
I used shadows because my Item property in Manufacturers class takes a
string (because I know the unique key is a string value), while the Item
property in the DataCollection class takes an object, because I want to
use it for various tables, some that have numeric keys, and some that
have string keys. If I change the DataCollection item class to take a
string key (which I could do), I then can do an OverRides property, but
like you said, that doesn't fix my problem.

In the Item property of my Manufacturers class, I tried using CType
already in this manner:
Return CType(MyBase.Item(Code), objManufacturer)

Is there somewhere else I should be using this line of code?

"Rick Mogstad" <Ri**********@GMail.NOSPAM.com> wrote in message
news:Ri**********@GMail.NOSPAM.com:
My previous response doesnt really address your question though. You are
still going to have to CType the result because you are ASKING for a generic
object by asking for it from the base class.
"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...
I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup table"
from my database that contains lists of things like manufacturers, makes,
modes, etc. of cars. I have created a generic "datacollection" class and a
generic "dataobject" class to represent the table and the rows within that
table as a collection of objects with generic properties for manipulating
fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I have
then written subclasses to more specifically use the base class for a
particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from DataObject.
So, back to my problem. In the item method, the generic DataCollection
class requires a "Key" that will be used for the lookup. It then searches
its internal data table and returns the appropriate DataObject object.
However, what I WANT, is to create an overriding Item object in my
Manufacturers object that returns a MANUFACTURER instead of a DATAOBJECT.
So I created a Public Shadows property that returns a Manufacturer object
but callse the MyBase.Item function to get it. But MyBase.Item returns a
DataObject, not a objManufactuer, and then I get thrown my Invalid Cast
Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

.

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String) as
objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

.

End Class




Nov 21 '05 #6

"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:uD**************@TK2MSFTNGP15.phx.gbl...
I used shadows because my Item property in Manufacturers class takes a
string (because I know the unique key is a string value), while the Item
property in the DataCollection class takes an object, because I want to use
it for various tables, some that have numeric keys, and some that have
string keys. If I change the DataCollection item class to take a string key
(which I could do), I then can do an OverRides property, but like you said,
that doesn't fix my problem.

In the Item property of my Manufacturers class, I tried using CType
already in this manner:
Return CType(MyBase.Item(Code), objManufacturer)

Is there somewhere else I should be using this line of code?

Larry has pointed out why your aproach wont work, but it still seems more
practical to make the base Item property overridable, then make your derived
Item Property 'Overloads Overrides' to make it a string. This really only
applies if you plan to pass around your derived class as the base class type
however, so if you are sure you are never going to do that, then feel free
to use shadows.
Nov 21 '05 #7
That makes sense, and that was how I was visualizing it, but couldn't
think where to put the code. I tried that out (I made another
constructor for my Manufacturer object that takes a DataObject).

THANK YOU!

Chet
"Larry Lard" <la*******@hotmail.com> wrote in message
news:la*******@hotmail.com:
Write a constructor for objManufacturer that accepts a objDataObject;
then in objManufacturers.Item, do this:

Public Shadows Readonly Property Item(byval Code as String) as
objManufacturer
Get
return New objManufacturer(MyBase.Item(code))
End Get
End Property

Your problem is this (and I agree it might seem non-intuitive): if you
want to specialise an object (ie make a derived-class object from a
base-class object), you must *explicitly* specify how to do it, by
means of an appropriate constructor or otherwise. That is, using the
usual OO example, you CAN'T say

Dim a as Animal = New Animal
Dim d as Dog = a ' nuh uh!

without somewhere saying exactly how you want to make a Dog from an
Animal. It's a similar idea to the way that constructors can't be
inherited - when you specialise you take on the burden of explaining
the specialisation.

Chet Cromer wrote:
I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup
table" from my database that contains lists of things like
manufacturers, makes, modes, etc. of cars. I have created a generic
"datacollection" class and a generic "dataobject" class to represent the
table and the rows within that table as a collection of objects with
generic properties for manipulating fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I
have then written subclasses to more specifically use the base class for
a particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from
DataObject. So, back to my problem. In the item method, the generic
DataCollection class requires a "Key" that will be used for the lookup.
It then searches its internal data table and returns the appropriate
DataObject object. However, what I WANT, is to create an overriding Item
object in my Manufacturers object that returns a MANUFACTURER instead of
a DATAOBJECT. So I created a Public Shadows property that returns a
Manufacturer object but callse the MyBase.Item function to get it. But
MyBase.Item returns a DataObject, not a objManufactuer, and then I get
thrown my Invalid Cast Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

.

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String)
as objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

.

End Class


Nov 21 '05 #8
And another reason I can't (I think) use overrides is that the Item
property of a Manufacturers object returns a Manufacturer, while the
Item property of a DataCollection object returns a DataObject. When I
used overrides it told me I had to return the same type of data; is
there a way around these two obstacles so I don't have to break
Polymorphism?

The Manufactuers Item property needs to look like this:
Public Readonly Property Item (Key as string) as Manufacturer

I know the Key is a string, and I want to return a Manufacturer class

And the generic DataCollection Item property needs to look like this:
Public Readonly Property Item (Key as object) as DataObject

I could easily get around the Key as object issue by writing several
different Item properties (StringKey as String), (NumericKey as
Integer), etc., but I still have the issue of the type of my returned
object, don't I?


"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:ch*******@ccrtc.com:
I used shadows because my Item property in Manufacturers class takes a
string (because I know the unique key is a string value), while the Item
property in the DataCollection class takes an object, because I want to
use it for various tables, some that have numeric keys, and some that
have string keys. If I change the DataCollection item class to take a
string key (which I could do), I then can do an OverRides property, but
like you said, that doesn't fix my problem.

In the Item property of my Manufacturers class, I tried using CType
already in this manner:
Return CType(MyBase.Item(Code), objManufacturer)

Is there somewhere else I should be using this line of code?

"Rick Mogstad" <Ri**********@GMail.NOSPAM.com> wrote in message
news:Ri**********@GMail.NOSPAM.com:

My previous response doesnt really address your question though. You are
still going to have to CType the result because you are ASKING for a generic
object by asking for it from the base class.
"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:e0**************@TK2MSFTNGP14.phx.gbl...

I am creating a set of base classes and sub classes to use throughout a
program I'm developing. The base class represents a generic "lookup table"
from my database that contains lists of things like manufacturers, makes,
modes, etc. of cars. I have created a generic "datacollection" class and a
generic "dataobject" class to represent the table and the rows within that
table as a collection of objects with generic properties for manipulating
fields, adding rows, etc.

The problem I'm having is that I have a generic "Item" method in the
DataCollection class that takes a key parameter and then looks it up in
the data table and returns the information as a "DataObject" class. I have
then written subclasses to more specifically use the base class for a
particular type of data (in the example I'm providing, a vehicle
manufacturer). So I now have a "Manufacturers" object that inherits from
DataCollection and a "Manufacturer" object that inherits from DataObject.
So, back to my problem. In the item method, the generic DataCollection
class requires a "Key" that will be used for the lookup. It then searches
its internal data table and returns the appropriate DataObject object.
However, what I WANT, is to create an overriding Item object in my
Manufacturers object that returns a MANUFACTURER instead of a DATAOBJECT.
So I created a Public Shadows property that returns a Manufacturer object
but callse the MyBase.Item function to get it. But MyBase.Item returns a
DataObject, not a objManufactuer, and then I get thrown my Invalid Cast
Exception.

I hope that explains my predicament. Can anyone help? Here is the basics
of my code:

Public Class objDataCollection

Public Readonly Property Item (byval Key as Object) as
objDataObject

Get

...

Return new objDataObject(...)

End Get

End Property

End Class

Public Class objDataObject

.

End Class

Public Class objManufacturers

Inherits objDataCollection

Public Shadows Readonly Property Item(byval Code as String) as
objManufacturer

Get

return MyBase.Item(code)

End Get

End Property

End Class

Public Class objManufacturer

Inherits objDataObject

.

End Class




Nov 21 '05 #9
I won't be passing the classes around as a base class. The base class is
just there to simplify most of the data access code, collection
handling, and things like that. When I pass objects around I'll always
be passing around the subclasses.

And I tried changing to Overloads Overrides but still get the following
error:

'objManufacturer' cannot override 'Public ReadOnly Default Property
Item(Key As String) As objDataClassObject' because they differ by their
return types."

I think I'm good, thank you both for your help.

"Rick Mogstad" <Ri**********@GMail.NOSPAM.com> wrote in message
news:Ri**********@GMail.NOSPAM.com:
"Chet Cromer" <ch*******@ccrtc.com> wrote in message
news:uD**************@TK2MSFTNGP15.phx.gbl...
I used shadows because my Item property in Manufacturers class takes a
string (because I know the unique key is a string value), while the Item
property in the DataCollection class takes an object, because I want to use
it for various tables, some that have numeric keys, and some that have
string keys. If I change the DataCollection item class to take a string key
(which I could do), I then can do an OverRides property, but like you said,
that doesn't fix my problem.

In the Item property of my Manufacturers class, I tried using CType
already in this manner:
Return CType(MyBase.Item(Code), objManufacturer)

Is there somewhere else I should be using this line of code?


Larry has pointed out why your aproach wont work, but it still seems more
practical to make the base Item property overridable, then make your derived
Item Property 'Overloads Overrides' to make it a string. This really only
applies if you plan to pass around your derived class as the base class type
however, so if you are sure you are never going to do that, then feel free
to use shadows.


Nov 21 '05 #10
I'm back to my inheritance problem again, with a new twist.

My DataCollection object exposes a readonly "collection" property that
returns a collection of DataObject objects.

I want my Manufacturers object (a subclass of my DataCollection object)
to return a collection of Manufacturer object, but since the code for
creating the collection is in my base class, it doesn't know what type
of objects the subclass will be wanting to the code creates a collection
of DataObject objects... and then when I try to loop through them as
Manufacturers to get the extra functionality of the Manufacturer object,
I cannot.

Here is my current code to create the collection. This is part of the
base class DataCollection:

Public Class DataCollection
Public Readonly Property Collection() as ICollection
Get
'Gets an array of rows to build the collection from
Dim Rows() as DataRow = mDataTable.Select()
Dim Row as DataRow
Dim Col as New Collection
For Each Row in Rows
'Create an object, the constructor utilizes the current row
Dim obj as New DataObject(row)
Col.Add(obj,obj.Key)
Next Row
Return Col
End Get
End Property
End Class

Here then is the code I want to use to loop through each manufacturer

Dim Mans as new Manufacturers
Dim Man as Manufacturer
For each Man in Mans.Collection
Msgbox Man.ManufacturerName
Next Man

The problem is that Mans.Collection returns a collection of DataObject
objects, not Manufacturer objects. I cannot figure out how to tell the
Collection property of the DataCollection object to create a collection
of differently types objects depending on what is inheriting it, because
of course it doesn't know. The only thing I can think of doing is
creating an Overriding property in the Manufacturers object like this:

Public Overrides Readonly Property Collection() as ICollection
Get
Dim ColNew as New Collection
Dim DO as DataObject
For Each DO in MyBase.Collection
ColNew.Add DO.Key,New Manufacturer(do)
Next DO
Return ColNew
End Get
End Property

This code loops through all the DataObjects in the collection and
transforms them into Manufacturer objects using the code we talked about
earlier where I pass the DataObject to the constructor of my
Manufacturer object.

Are there any better ways around this? One that WON'T have me writing a
block of code every time I need to create a collection property, which
is part of the reason I'm trying to create a base class for.

Nov 21 '05 #11

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

Similar topics

7
by: Ray Gardener | last post by:
C++ doesn't allow: class counter : public int {}; Was there any special reason why base class ids can only be struct/class ids? This limitation appears to violate the concept of uniform...
11
by: Noah Coad [MVP .NET/C#] | last post by:
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...
3
by: sureshsundar007 | last post by:
Hi all, I'm trying to inherit the SimpleWorkerRequest class but cant able to do so. I'm getting an error called "System.Web.Hosting.SimpleWorkerRequest.SimpleWorkerRequest()' is inaccessible...
3
by: Rob Richardson | last post by:
Greetings! I am trying to make it possible for new derived classes of an object to be used by my application without rebuilding the application. The new classes will be made known to my...
5
by: Chris Capon | last post by:
Is there any way to cast a base class object to a derived class datatype when the derived class adds no new fields nor alters the object allocation in any way? The scenario would be where you...
10
by: Brett Romero | last post by:
Say I have a class inheriting some base class: BaseClass { void Foo() { Update(); } }
0
by: robert | last post by:
Hi all, I'm having a hard time resolving a namespace issue in my wsdl. Here's an element that explains my question, with the full wsdl below: <definitions name="MaragatoService"...
24
by: AtariPete | last post by:
Hey All, I have a C# question for you regarding up casting (base to derived). I was wondering about the most elegant way (readable, less code) to cast from a base type to its derived type....
12
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, I have a class which "BiologySequence" which looks about like this. public class BiologySequence { private string _Sequence; public string Sequence {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...
0
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...
0
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,...

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.