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


ADVERTISEMENT

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 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

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

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

How To Inherit A Abstract Class In Code Behind

Aug 25, 2009

By Default code behind looks like --
Partial Public
Class InhAbs

[code].....

View 2 Replies

Overloaded Constructor In Abstract Class

Nov 19, 2010

I have an abstract class in vb.net with two subclasses. In the abstract class I have a constuctor that looks like this:[code]I would like to create a second constructor that doesn't take any arguments and just initializes the args to default values.[code]When I attempt to create a new subclass using the second constructor the compiler complains that I'm missing two args to the constructor.Is there a reason I can't overload the constructor in the abstract class?

View 2 Replies

Protected Constructors And MustInherit / Abstract Class

Jul 5, 2009

What is the difference between a class with protected constructors and a class marked as MustInherit? (I'm programming in VB.Net but it probably equally applies to c#). The reason I ask is because I have an abstract class that I want to convert the constructors to shared/static methods. (To add some constraints). I can't do this because it's not possible to create an instance in the shared function.

[Code]...

View 3 Replies

Get Different Value Type Out Of Concrete Implementation If Only Interface / Abstract Class Is Known?

Feb 28, 2011

I am creating an xlsx reader / writer for my application (based on OpenXML SDK 2.0). I want to read xlsx files and store the data contained in each row in a DTO/PONO. Further I want to read the xlsx file and then modify it and save it.Now my problem is not with the OpenXML SDK, I can do what I need to do.My problem is on how to structure my components. Specifically I have problems with the polymorphism at the lowest level of a Spreadsheet, the cell.A cell in Excel/OpenXML can have different types of data associated with it. Like a Time, Date, Number, Text or Formula. These different type need to be handled differently when read/written from/to a spreadsheet.I decided to have a common interface for all subtypes like TextCell, NumberCell, DateCell etc.Now when I read the cell from the spreadsheet the Method/Factory can decide which type of cell to create.

Now because the cell is an abstract from the real implementation it does not know / does not need to know of what type it is. For writing / modifying the cell I solve this problem by calling .write(ICellWriter) on the cell I want to persist. As the cell itself knows what type of data it contains, it knows which method of ICellWriter it needs to call (static polymorpism).Writing to the xlsx file is no problem. My problem is, how do I get the data out of my cell into my DTO/PONO without resorting to type checking -> If TypeOf variable is ClassX then doesomething End If. As Methods / Properties have to have different Signatures and differentiating by only using a different return type is not allowed.The holder (collection, in this case a row of a table/spreadsheet) of the objects (refering to the cells) does not know the concrete implementations. So for writing a cell I pass it a Cellwriter. This Cellwriter has overloaded methods like Write(num as Integer), Write(text as String), Write(datum as Date). The cell object that gets this passed to it then calls the Write() method with the data type it holds. This works, as no return value is passed back.After some thinking about the problem I came to realize that it's not possible without reflection or knowledge of what type of cell I am expecting. Basically I was trying to recreate a spreadsheet or something with similar functionality and way too abstract/configurable for my needs.

View 1 Replies

Overloading Functions - Overloads In The Abstract Class Implementation ?

Oct 7, 2011

I have recently come across some code that has the following. First there is a Interface with the following function Function Validate() As Boolean. That interface is then implemented in the an 'ABSTRACT' class like this.
Public MustOverride Overloads Function Validate() As Boolean Implements IBusinessEntity.Validate

Question 1: Why use Overloads in the Abstract class implementation.

Question 2: The Abstract class is then inherited into a class (TestClass). In TestClass the Validate function is implemented as follows Public Overloads Overrides Function Validate() As Boolean. I understand the Overrides keyword is to insure that this is the version of the Validate that you want called and not the Abstract class version but why again use the keyword Overloads?

From what I understand you can overload a constructor of a class by simply changing the constructor signature. Also, you overload Methods and Properties of a class by using the Keyword Overloads. But why do it when your implementing an Interface method, or an Abstract Class method that's inherited.

View 2 Replies

Pass A Delegate Into A Constructor Of An Abstract Class From A Descendant's Constructor?

Feb 15, 2010

I have an abstract class which requires a delegate to function. I pass the delegate into the constructor. Now that I have a non default constructor I need to call the abstract class's constructors from the concrete class which means that I need to use MyBase.New(...). I have included a quick example below.

Public MustInherit Class BaseClass
Public Delegate Sub WorkMethod()
Private _Work As WorkMethod

[code]....

I have tried to do this but I keep getting the following error: "Implicit reference to object under construction is not valid when calling another constructor".Can I not do what I am trying to do above? I initially had the delegate setup in its own setter method. But then I am creating a deceptive API because it does require a point to a method to work properly.

View 3 Replies

Homework - For Loop Won't Execute

Sep 13, 2011

EDIT: Solved (see comments) I have a For loop inside a sub, and right below it I have a MessageBox function. Everything compiles correctly, however for some reason, if the loop executes and exits successfully, anything outside and below the For doesn't get executed.

[Code]...

it displays only 10 items in the ListBox afterwards. I've searched everywhere, but I did not find anything related to such an issue. I'm kinda puzzled, anyone got a clue of what's going on? EDIT: Forgot to specify, the sub is actually a TextBox.TextChanged event

View 1 Replies

VB Trying To Make Sense Of Homework?

Feb 16, 2011

So my teacher gave us this assignment that I'm having trouble understanding why she wants us to write outside of the button Private Sub.1. Write the code for the Calculate Total and Grand Total button a. Declare a variable to accumulate the individual totals outside the sub procedures b. Calculate the total by multiplying the selected number of atendees by the selected cost, and display this total in the label next to Total c. Calculate the grand total by adding the total calculated in step 3.b to the grand total variable. Display the grand total next to Grand Total I'm don't understand why she says 1a. I feel like you can just write all the variables in the same Sub on the calculate button.

View 8 Replies

Cell Phone Package Homework?

Oct 26, 2009

Have to develop an application that will let me choose between cell phone plans, individual and family plans i have the forms and all choices done,. new forms open and old ones hide to keep it clean. i think i got all the variables declared, and got no debugging errors, but when i select the options, it always gives me the following:

1. adds one more phone than selected

2. only shows phone subtotal, tax and total

3. prices for options and monthly fees never show

Here is my code for all 3 forms

Public Class frmMain
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub

[code]....

View 9 Replies

Homework - .net Converting Week To Date?

Jun 29, 2011

I am developing an ASPX VB.NET file. My assignment is to convert an integer representing week of the year into that end date. For example, if user selects Week 4 for 2011, I want to get date = 1/22/11. How do I do this in VB.NET?

View 2 Replies

Homework - Change Keyboard Language By API?

Apr 30, 2012

I'm supposed to change the keyboard language to Farsi(Persian) by using API functions while the program is running( It's a plain form with a text box). I'm already late for the due date.

View 1 Replies

Homework - Clearing A Dropdown Menu In .Net?

Mar 31, 2012

I have two drop down boxes in my program. When you select an item from the first drop down, it populates select-able items in the second. When I select something in the second and then change the selection in the first one, the values remain in the second. How do I "reset" the second drop down when the first is changed?

View 1 Replies

Homework - Fibonacci Sequence In .net Using Loop?

Apr 3, 2011

displaying the first 10 Fibonacci numbers. My code displays the following result: 1, 2, 3, 5, 8, 13, 21, 34, 55 and I need it to also display the first two Febonacci numbers (0 and 1). How would I do that?

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer = 0

[code]....

View 3 Replies

Homework - Test Fires The Message Box Twice?

Sep 20, 2011

I am trying to unit test for data being input into a textbox (txtPrice). If it is not numeric, it throws a messagebox stating that the input must be numeric. However, when I unit test, I can't figure out why my test fires the message box twice.THis is my (simple) unit test:

Public Sub txtBoxes_LeaveTest()
Dim target As frmEstimate_Accessor = New frmEstimate_Accessor ' TODO: Initialize to an appropriate value
Dim sender As Object = Nothing ' TODO: Initialize to an appropriate value[code].....

My understanding is that for unit testing, you declare the sender, and (in this case) set the sender to some value that will trip the message box. 112L should do this on the leave event. I then write my expected, which in this case is 112L, fire the event, and then get the actual out of the text box. I then Assert.AreEqual to ensure the expected and actual are the same.

View 2 Replies

Homework - Testing A Trace Table?

Dec 29, 2011

Working through trace tables and wanted to check to see if my results where correct, I have designed the following code to check each stage of the loop, but the code keeps throwing up an error about casting when i try to run it. I can see when the error comes back that the writeline is holding info but what have i done wrong.

Module Module1
Sub Main()
Dim aWord As String

[Code]....

View 1 Replies

Homework - .net Network Graph Code/algorithm?

Dec 8, 2010

For a school project we need to visualise a computer network graph. The number of computers with specific properties are read from an XML file, and then a graph should be created. Ad random computers are added and removed.Is there any open source project or algorithm that could help us visualising this in VB.net? Or would you suggest us to switch to java.

Update: We eventually switched java and used the Jung libraries because this was easier for us to understand and implement.

View 1 Replies

Homework - Declare A Two Dimensional Array With 5 Rows And 3 Columns

Nov 2, 2010

I've been taking a class on it this semester and am starting to get very confused and behind. I've been pretty stuck on my hwk assignment for this week and was wondering if anyone could possibly hint at what I'm doing wrong or if I'm just completely way off. The whole rows and columns in arrays seems to be throwing me off now. Also, sorry if this is not the right place to post something like this I was not sure which section this fit under.

[Code]...

View 2 Replies

Homework - Write A Program To Print Only Even Numbers Between 6 And 16 Using Events

May 22, 2011

I was given an assignment to "write a program to print only even numbers between 6 and 16 using events", but I don't even know where to begin. The main thing I am having difficulty with understanding in this assignment is how I am supposed to specify that it only print even numbers in the given range of numbers.

Am I going to have to do a Mod2 code for each individual number and have it exclude any with the result of 1? Or is there another piece of code specifically designed for such an occassion? Perhaps there is some type of equation I can have the program read in terms of a variable, which holds the values of 6, 8, 10, 12, 14, and 16? I am just genuinely confused on how this is supposed to be programmed.

View 3 Replies

Programming Challenge (not Homework) Editing Many Files Quickly

Dec 3, 2009

I have 202 .html files and at the beginning of each file, I need to add a chunk of php code. I could make this myself, but to be honest, it would take me forever and I might as well just manually edit them lol. All the .html files are in one folder.[code] one other thing that would be VERY cool, is if it could add the files that are not edited to a listbox or an outputted text file.

View 12 Replies

Understanding The PDF DOM

Apr 29, 2011

I am writing an application that has to read and interpret data stored in some PDF files. The reading part is done but I am only able to get a dump of all the words on a page and not the format of the words. What I mean is that if I have to extract a table, I am getting the numbers in the table but not the markup which defines the table.

Further, there is some formatting used which displays a few of these numbers within parentheses (meaning that those numbers are negative) but the parentheses themselves are not part of the text. Hence, I am not able to distinguish between positive and negative numbers present in the PDF table!

How do you get the PDF markup along with the text? Is a PDF similar in structure to an XML with tags used to markup tables etc.? If not, then, is there a resource which describes the salient features of the PDF DOM? I am using VBA and the Acrobat library (AcroExch etc.)

View 4 Replies







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