Questions tagged [class-design]

Refers to structural definition of class unit in object-oriented languages.

1125 questions
0
votes
3 answers

How to design my class

I have a class, which returns three properties. First property is dependent on some parameter, second one is dependent on the first property and third one is dependend on the second property. What is the best way, to implement this type of class,…
sventevit
  • 4,766
  • 10
  • 57
  • 89
0
votes
2 answers

Temporary Storing data entered in steps in class in asp.net

how can i store different data enetered using multiple steps? Its 4-5 step procedure, user can go through each step & at the final submission i want to store it in database. I want to create class to store this data & store the data in object of…
Pragnesh Patel
  • 1,444
  • 3
  • 23
  • 38
0
votes
2 answers

C++ DAL Design - Include Foreign Key Table as Composite Object

I recently posted this C++ DAL question about how best to design a 'loadCar' method in a C++ DLL, with the consensus being that 'bool DAL::loadCar(int id, Car&) {}' would be the best signature to use. Now, it so happens that in a lot of our use…
ng5000
  • 12,330
  • 10
  • 51
  • 64
0
votes
1 answer

Implementing rights management in class design

I have to do a Project where there will be a number of users who will use the application. Users can belong to either Users, Executive or Administrator. Each Usergroup has their own rights. All data will be stored in a database. Now I am doing the…
LeonidasFett
  • 3,052
  • 4
  • 46
  • 76
0
votes
6 answers

How to read data for nested classes?

I'm sorry if my question isn't clear. I have a class contain some properties and one of them is "Parent" which the same type of this class. when i read data from Database i set the suitable value for each property. But how could i put the "Parent"…
Wahid Bitar
  • 13,776
  • 13
  • 78
  • 106
0
votes
2 answers

Residing a member of parent class type inside another class

#include class BarParent { virtual void fuz() { std::cout << "BarParent" << std::endl; } }; class BarChild : public BarParent { virtual void fuz() { std::cout << "BarChild" << std::endl; …
aiao
  • 4,621
  • 3
  • 25
  • 47
0
votes
1 answer

generalizing classes or not when using mapper for database

lets say i have the following classes: customer, applicant, agency, partner i need to work with databases and use mappers to map the objects to the database. my question is, can i generalize these classes with the class person and just implement a…
LeonidasFett
  • 3,052
  • 4
  • 46
  • 76
0
votes
4 answers

Preventing class data inheritance

I have a database abstraction layer that starts with a base class like so: class DB { function DB() { $this->host = "xxx"; $this->db = "xxx"; $this->user = "xx"; $this->pass = "xx"; $this->dbh = mysql_connect($this->host,…
jerrygarciuh
  • 21,158
  • 26
  • 82
  • 139
0
votes
5 answers

How to design a C++ class?

I wrote a application in MFC with C++. I need to write a class which can save all the data loaded from the database, These data might contain every kind of data type, such as int, string, byte, boolean, datetime and so on. We might filter, exchange…
MemoryLeak
  • 7,322
  • 23
  • 90
  • 133
0
votes
3 answers

Can I create a generic base class for this case? Any other suggestions?

Possible Duplicate: C# -Generics Help Let’s start with this interface IBar as below. public interface IBar : IQueryable, IEnumerable where T : class { } I have following 3 classes Bar1, Bar2 and Bar3. public class Bar1 { …
0
votes
1 answer

Does it make any real sense to make read-only properties out of "reference types" in an AS3 class?

Take the following code: private var m_iQuanitity:int; public function get quantity():int { return m_iQuantity; } That seems to make perfect sense. You can see what the quantity is from an outside class without any problems, but you can't…
Panzercrisis
  • 4,590
  • 6
  • 46
  • 85
0
votes
3 answers

how to tell if specifications are modelled using database oriented approach or class design oriented approach

Given a problem specification, how to tell if it is a database design problem or class design(object oriented design) problem?
stallion
  • 1,901
  • 9
  • 33
  • 52
0
votes
1 answer

Lifetime of variables: Reference becomes NULL

I have a problem regarding the lifetime of a variable. My Android-App should write sensor-data to a file and send this file to a server. For this I created a Activity (Main-Activity) and two Services. One is for writing the sensor-data to files…
steckl
  • 404
  • 8
  • 16
0
votes
2 answers

Design a data model to flat file transformation... delegates or inheritance?

I have a maintenance application that has to turn enterprise data (from various databases/tables) into flat files, each in a specific format, for consumption by a legacy application. I've got data models like public class StatusCode { public…
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
0
votes
1 answer

Class design with params and dependencies

I designed my database and cache layer after Zend Framework 1, like this: class Cache { public static function create($adapter, array $params) { $class_name = 'Cache_Adapter_' . $adapter; return new $class_name($params); …
Hemaulo
  • 979
  • 2
  • 9
  • 16