Inheritance Of Abstract Method And Generics With Odbc... And Sql... Types?

May 26, 2011

Is this possible in object-oriented design? I'd like to specify that in an inheritance tree, the type of a property in the child classes is different from the type of that property in the parent class. But the types are polymorphic because they derive from the type used in the parent class. e.g.:

[code]....

View 8 Replies


ADVERTISEMENT

C# - Appropriate To Use Generics Versus Inheritance?

Apr 28, 2009

What are the situations and their associated benefits of using Generics over Inheritance and vice-versa, and how should they be best combined?I'm going to try to state the motivation for this question as best I can:I have a class as shown below:

[Code]...

Now suppose I have a repository that takes an InformationReturn argument, that has to strore different fields in a DB depending on the type of Info object T is. Is it better to create different repositories each for the type T is; one repository that uses reflection to determine the type; or is there a better way using inheritance capabilities over/with generics?

View 6 Replies

IDE :: Using XML Literals With Abstract Xml Types?

May 3, 2011

I'm trying to use the builtin XML literals feature to create/read xml files using my own schemas, but I don't see a way to cast an abstract XElement from a base type to a more derived type.The schema/xml below shows in general what I'm working with, but using XML literals only allows me to use the base type in the IDE, so the xml below is treated as a collection of elements of the base type, instead one of the base type and one of the derived type.

<schema targetNamespace="Test" xmlns="Test">
<xs:complexType name="Base" abstract="true">
<xs:attribute name="Id" type="xs:int">

[code]....

View 1 Replies

Generics - List(Of T) - Use It To Hold Items Of Several Types?

Oct 3, 2009

Assuming a base type of "Message"...

[Code]...

I would like to have one collection of Message objects which can be either PhoneMessages or MailMessages, so that I can iterate through the list and deal with each message based on what type it happens to be.

Attempting just to use .Add() fails, saying that I can't add an item of type PhoneMessage to a List(Of Message). Is there some elegant way to accomplish what I'm trying to do? I had thought I could accomplish this with generics, but I think there's a gap in my understanding. If it can be accomplished in .NET 2.0, that would be ideal.

View 4 Replies

Inheritance - Create A Method Called StartWorking() And Want FrmChild To Inherit - Method

Nov 25, 2011

I have a large problem with inheritance in vb.net. The problem is the following:

I have 2 forms => frmBase and frmChild

In frmBase i want to create a method Called StartWorking() and i want frmChild to inherit this method.

But here is the tricky thing: when frmChild.StartWorking is called i would like the following => without calling MyBase.StartWorking()

I want frmBase.StartWorking() to be executed first and after a test in frmBase.StartWorking if blnValue is true then frmChild.StartWorking has to be activated. if blnValue is false that frmChild.StartWorking cannot be activated.

View 2 Replies

Inheritance - Dependent Types In .NET?

Sep 14, 2011

I was wondering if it is possible to have dependent types in VB.Net 4, or alternatively, if it is possible to construct inherited objects based on the base class' constructor's parameter(s). For example,

[Code]...

View 1 Replies

ODBC Support For Informix Serial And BigInt Data Types

Jan 20, 2010

I have Informix Dynamic Server 11.50 and Informix Client SDK 3.5 installed on my server. I am developing a .NET application to read data from Informix database using ODBC functions. In the database, i have a table with columns of Serial and BigInt data types defined. My data retrieve function looks like this [Code]

I've tried to modify the columns with Serial and BigInt data types to Integer. And, everything works fine without modifying a single line of code. I do need some advice how to overcome this problem as i need the Serial data type column as an incrementing id column. For BigInt data type column, may be we can change it to column with Integer data type instead.

View 2 Replies

Constrain A Generic Method / Extension Method To Numeric TYPEs Only?

Sep 16, 2010

Write an overload for every numeric type or if possible constrain a generic extension method to just numeric types.

View 2 Replies

.net - Interface Inheritance: Method Does Not Show Up

Feb 15, 2010

I've got an interface inheritance issue that has been vexing me for some time. It doesn't seem to make any sense, and I can only conclude that I'm missing something fundamental.

Overview The code below is from part of a fluent interface for our ORM tool. It provides a SQL-like syntax for pulling data from the database. You don't have to completely grok all the interrelations to understand the problem -- the real issue is the EndClause method.

The EndClause Issue There's a method called EndClause that doesn't show up in one expected spot -- IOrderQueryRoot. As far as I know, it should show up because it inherits from two different interfaces that both have a method called EndClause, but when I consume an object that implements IOrderQueryRoot, EndClause does not pop up in intellisense.

There are some more implementation details below.First though, if you look at IOrderQueryRoot (which contains EndClause), you can see that it inherits IHasOrderLogicalOperators, and also IHasOrderFields (which also contains EndClause).

Public Interface IHasOrderLogicalOperators
Function [And]() As IHasOrderFields
Function [AndNot]() As IHasOrderFields

[code]....

At this point, the interface is working fine -- if I were to remove this method, VS would scream that I have to implement both EndClause methods. The problem is one level down, when the "end developer" is trying to actually write code against the interface.

View 1 Replies

Specific Method For Getting Non-primitive Types In An Assembly?

Mar 11, 2011

Is there any class or specific method for getting non-primitive types in an assembly? FieldInfo.Gettype() will do for primtive types but what about non-primitive types?

View 3 Replies

C# - From A List<object> , ToString() Them Just When They Are Primitive Types Or Have This Method Overridden??

Feb 15, 2011

Given a list of objects, I'd like to print a string version of them just in case the object.ToString() result is a relevant string.By that I mean I don't want to get things like:

obj.ToString() -> System.Collections.Generic.List`1[MyLib.Dude]
obj.ToString() -> System.Collections.Generic.Dictionary`2[System.Int32,System.DateTime]
obj.ToString() -> System.Byte[]

But I want to get things like:

obj.ToString() -> Hi
obj.ToString() -> 129847.123
obj.ToString() -> Id = 123

What should be the best way to implement this in a method:

Public Sub PrintInterestingStuffOnly(ByVal coolList as Ilist(Of Object))
For Each obj in coolList
'insert solution here

[code].....

View 3 Replies

Using ODBC Works Fine On 32-bit But Unable To Locate ODBC On 64-bit

Oct 24, 2011

I have a small vb.net application that fires a crystal report through crystal viewer.

The report uses an ODBC connection provided by 32-bit software accounts package, which is installed in the ODBC 32-bit This all works fine on 32-bit XP and 32-bit Win7 with no problems, When run on a win7 64-bit machine the application launches ok, but when it comes to running the report, it prompts for a database logon box for the odbc connection.

When the report is run seperate on its own, on the exact same pc through crystal reports desginer it runs fine, Its almost like the application is not picking the 32-bit ODBC set up is it the case that the connection needs to be coded rather than using the report connection,

View 3 Replies

ODBC Data Adapter / System.Data.Odbc Can't Find It?

Nov 23, 2006

i am new to vb .net i just want to ask why is it i don't see the odbc data adapter in the toolbox pane? i just have (under data) pointer, dataset, datagridview, bindingsource, and binding navigator.

View 3 Replies

C# :: Determining Object Equivalence For Value Types, Reference Types And ILists?

Nov 1, 2009

I have a class with a Property called 'Value' which is of type Object.Value can be of any type, a structure, a class, an array, IList etc.My problem is with the setter and determining whether the value has changed or not.This is simple enough for value types, but reference types and lists present a problem.For a class, would you assume that the Equals method has been implemented correctly, or just assume that the value has changed every time the setter is called?If I did assume it's changed, then perhaps I should assume it for value types as well, so that the behaviour is consistent.

View 2 Replies

Using Dll In C++ - Class Is Abstract?

Jan 6, 2010

I created a vb.net dll which I am using in an unmanaged c++ project.When I try to create an object of the class, I am getting an error:cannot instantiate abstract class.Why would my class be abstract? How can I modify it so that it won't be abstract?

View 1 Replies

Abstract One By One Numbers From The Textbox

Sep 29, 2009

I am doing a project on abstract the numbers that i get from the datagridview to append it on the other textbox. Ok I elaborate more. I have 2 form which is form1 and form2. For the form1, the view is 2 textbox and a 'To' button. when click on the 'To' button, it is direct to form2 which is the datagridview. After selecting the selected numbers, it will display the numbers on the form1 of the one of the textbox. but the problem is I want to abstract one by one of the numbers and append it on the other textbox of the form1.

View 9 Replies

Abstract One By One Of The Numbers From The Textbox?

Sep 29, 2009

I am doing a project on abstract the numbers that i get from the datagridview to append it on the other textbox. Ok I elaborate more. I have 2 form which is form1 and form2. For the form1, the view is 2 textbox and a 'To' button. when click on the 'To' button, it is direct to form2 which is the datagridview. After selecting the selected numbers, it will display the numbers on the form1 of the one of the textbox. but the problem is I want to abstract one by one of the numbers and append it on the other textbox of the form1.

View 1 Replies

Strongly-typed Generic Method Invokes Its Argument's Base Class Method Instead Of A Shadowed Method In T?

Oct 19, 2010

Consider a MyForm class that contains a shadowed implementation of Show(). It also contains a CreateForm() method, which accepts an instance of the form and calls the shadowed sub:

[Code]....

View 3 Replies

Abstract Class Be Better Than An Interface In The Following Case?

Mar 30, 2011

I have one interface that contains four functions. I have about 20 classes that implement this interface. Throughout each class, I see a lot of duplicate code, for example, there are constants declared at the beginning that are in every class. The method implementations (logic) of the interface are mostly the same.It contains duplicate structures. Is this a case where I can eliminate a lot of duplicate classes by implementing an abstract class instead of an interface. What I am striving for is too be able to put common methods from the abstract class as non-abstract methods and then methods that need their own implementation would be marked over-ridable. Can I put consts and structures in abstract classes? If so, that would eliminate a lot of duplicate code across the classes. Is there anything else I should look out for in the classes as a sign that I probably should be use an abstract class instead of an interface.

View 2 Replies

Abstract Class Inside An Interface?

Sep 8, 2011

I'd like to make sure each of the subclasses has a certain nested class whose actual fields are up to the developer.

Nesting an abstract class inside the base abs. class doesn't seem to do the trick because during actual coding, both the nested abs. class and the nested class in the subclass both are available (show up in intellisense).

Having the base class implement an interface that includes a class doesn't work since interfaces only refer to methods that can be implemented, not classes (meaning implementing the interface requires implements methods, but says nothing about classes in the interface.

View 2 Replies

Abstract Class Versus Interface?

Jan 31, 2011

understanding difference between an interface and an abstract class which has no function with implementation?which is better abstract cls or interface in term of speed, features..?

View 11 Replies

Asp.net - Use Abstract Classes In A 3-tier Solution?

Feb 1, 2012

My immediate issue is that currently I have a 3 tier solution (Presentation.aspx.vb calls BusinessLayer.vb which calls DataAccessLayer.vb). However, I want to make BusinessLayer and DataAccessLayer.vb abstract classes because several Webforms will use have the same functionality.

So I currently am doing this (no abstract classes):

'Presentation Layer (pseudocode)
public sub checkUser(byval userName as string, byval dept as string)
dim isGood as boolean = BL.checkUserAccess(userName, dept)

[Code].....

View 1 Replies

C# - Abstract Class Over Interfaces In ADO.Net Environment

May 13, 2010

I am developing a web app but is not satisfied with is architecture that I am following. The architecture is plain old conventional 3 tier architecture. What i want is follow some design pattern or architecture that will be help me in decoupling my code.I have idea about MVC and MVP architectures for Web App but i need different from that. I want to use OOPS concepts using abstract classes and interfaces, polymorphism etc in my app but not MVC and MVP. I dont know why?

View 2 Replies

C# - Difference Between MustInherit And Abstract Class?

Mar 4, 2011

explain to me the differences between an abstract class and a class marked MustInherit?

Both can implement shared and instance constructors and logic. Both can/must be inherited.

So why use one over the other and what is the difference?

Edit: Sincerely apologize I have got my languages mixed up. Will mark correct answer as soon as I am allowed.

View 2 Replies

C# :: Abstract Classes And ReadOnly Properties?

Jan 12, 2011

Let's have three classes;

Line
PoliLine
SuperPoliLine

[code]...

View 3 Replies

Caching Propertyinfo Of Abstract Class?

Jan 19, 2012

I've been playing around with implementing an abstract base class that using reflection accomplishes SQL to Object mapping.

I did some benchmarks and decided I wanted to implement a caching strategy for the property info of the objects (to prevent future lookups on them). My first instinct was to try and implement something like this.

Public MustInherit Class BaseModel
Implements IFillable
Private Shared PropertyCache As List(Of PropertyInfo)

[Code]....

View 1 Replies

Cannot Create Instance Of Abstract Class

Mar 31, 2010

I am trying to compile the following code and i am getting the error[code]...

View 2 Replies

Event Handling An Abstract Class?

Jul 6, 2010

Basically, I have a custom child form class which has events that will be passed to the parent. In the custom child form, I have a declaration of a "MustInherit" class that inherits the DevExpress User Control Class.

The reason for this, is I have many user controls that derive from this base class, and the child form can have an instance of any one of these controls, and doesnt care which. The only requirement is that the child form can handle the same events from each type of control the same way.

Some watered down code snippets(still pretty long unfortunately):
'''Inherited Class
Public Class ChildControlInheritedClass

[Code].....

View 1 Replies

Forms :: How To Abstract Data From Textpad Using Vb

Jul 26, 2009

I am new to visual basic 2005. I have done how to abstract telephone from the sql server database and display it. But the problem is i could not do by abstracting the telephone number from the notepad.

View 2 Replies

Homework - Net Abstract Class Understanding?

Dec 28, 2011

If i have a class called A and a class called B, if B inherits A that means A is the super class and B is the subclass. I have been asked to describe why class A is not an abstract class but as i see it class A is an abstract class A, as it has been created for Class B to use in the future, is it something to do with Class B not being able to access the fields in Class A as although they are private by default?

[Code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved