labeling a group of members as private/public in c#
in a c++ class declaration, you can label a group of members as private or public, e.g. private: int x; double y; seems like there's no way to do this in c#. am I wrong? ...
in a c++ class declaration, you can label a group of members as private or public, e.g. private: int x; double y; seems like there's no way to do this in c#. am I wrong? ...
class HelloObject { void speak() { System.out.println("Hello (from object)!"); } } class HelloTester { public static void main(String[] args) { HelloObject object = new HelloObject(); object.speak(); } } When I change the "HelloTester" class name to something like "HelloTester2", the program suddenly work...
I have the following class structure (abbreviated for sake of time, names changed) in my application. When I was writing the code I felt that the similarities between Action1 and Action2 should warrant some sort of generalization. I've provided the UML Class diagram with the relevant parts (except for the interfaces, which I describe in ...
I have the following code in C# and I am trying to find out why I am not able to access from a subclass that is from type list the elements of a class address. This is the code MemberList list = MemberDB.GetMembers("sql", m_page, m_RecordPerPage, out count, _state); /*******************************/ public static MemberList GetMe...
I want to create a class file dynamically. Here it goes... With the given ResultSet, extracting the metadata I want to build a class file dynamically with getter and setter methods for all the columns that exist in ResultSet. Also I should be able to use this class file generated where ever I want in my later use. Can any body suggest me...
I'm struggling to define a class method that populates and returns a collection of instances. The issue I don't know how to get around is that I have private attributes to populate. Let's use the example of a Book class. I don't want the code to directly set (say) the availability of a book. I want the code to have to use a CheckOut ...
The application I'm working on has a single class that maintains a database connection. All members of this class are static to enforce a singleton-like pattern, so the actual connection logic is performed in a static initializer block: public class HibernateUtil { private static final SessionFactory sessionFactory; static { ...
Working on our restricted system means I cant drop class librariess into the app_bin/bin/App_Code basically any normal folder, so I'm currently linking to my class library as follows... <%@ Page Language="C#" AutoEventWireup="true" CodeFile="~/cs/codebehind.cs" Inherits="codebehind" %> <%@ Assembly Src="~/cs/mycodelibrary.cs" %> The ...
I am confused how directory name, file name and class name all work together. This is what I have at the moment app.py database/ client.py staff.py order.py inside client.py I have a single class called client. This class acts as the database model (MVC), the same with my other files (staff.py has a class called st...
In your experience, what are some "smelly" keywords in class or function names that might be warning signs of bad object-oriented design? I've found that classes containing the word Manager or Base are often suspect. For example, a FooManger often indicates poor encapsulation or a singleton design that is difficult to reuse. A FooBase ...
Howdy Guys, Got some code here that isn't working: $("#sidebar ul li:last").each(function(){ $(this).addClass("last"); }); Basically I have 3 lists and want to add a class (last) to each item appearing last in each unordered list. <ul> <li>Item 1</li> <li>Item 2</li> <li class="last">Item 3</li> </ul> Hope ...
Hello, I'm trying to instantiate a class from variable, and written a test script. But, unfortunately, it isn't woriking. There is that script: Object co1 = new CommandDownloadHttp(); Class cc1 = Class.forName("CommandDownloadHttp"); Object co = cc1.newInstance(); Unfortunately on second line it crashes with java.lang.ClassNotFoundEx...
EDIT: See Below I have a web service which uses a class of functions in order to return data used in various business processes (via InfoPath). One of the functions takes a given SQLCommand object and executes it into a SQLDataReader. Now depending on the SQL command text used this may return one or many rows of one or many columns....
I have a dynamic ActionScript Class that is used to send parameters to a WebService. Some of these parameters are always present, so they are public properties of the Class: package { [Bindable] public dynamic class WebServiceCriteria { public var property1:int; public var property2:String; public v...
I have a dynamic Class that is a Value Object that is used to pass arguments to a WebService. It has two public properties: package { [Bindable] public dynamic class WebServiceCriteria { public var property1:String; public var property2:String; } } I set these two properties in one part of my applicati...
Say for a Point2 class, and the following Equals: public override bool Equals ( object obj ) public bool Equals ( Point2 obj ) This is the one that is shown in the Effective C# 3: public override bool Equals ( object obj ) { // STEP 1: Check for null if ( obj == null ) { return false; } // STEP 3: equivalen...
I'm trying to use Linq to return a list of ids given a list of objects where the id is a property. I'd like to be able to do this without looping through each object and pulling out the unique ids that I find. I have a list of objects of type MyClass and one of the properties of this class is an ID. public class MyClass { public int ...
Okay, so I have two classes, call them A and B--in that order in the code. Class B instantiates class A as an array, and class B also has an error message char* variable, which class A must set in the event of an error. I created a third class with a pure virtual function to set the errorMessage variable in B, then made B a child of that...
Say I have a Point2 class, and I want to implement the following Equals: public override bool Equals ( object obj ) public bool Equals ( Point2 obj ) This is from the Effective C# 3 book: public override bool Equals ( object obj ) { // STEP 1: Check for null if ( obj == null ) { return false; } // STEP 3: e...
I have an Employee class with a Name property of class Name and a Contact property of type Contact. The Name class has two string properties: FirstName and LastName and the Contact class has properties like PhoneNumber and EmailAddress. All of the data is found in one table and assume that it cannot be changed. What would my maps look...