GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 204 of 258    Print  
I have just started doing OOP design. My experience has been in RDBMS. Where we work with tables, relation between them defined using foreign keys. Can anyone pl. help in designing classes for a simple case here. There are two tables (states, districts). Districts contains stateId as foreign key. So state to district 1-many relation is there. Such things how do we design in oops. Thanx in advance

  
Total Answers and Comments: 2 Last Update: January 03, 2006     Asked by: sudha 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 22, 2005 00:54:36   #1  
rrl Member Since: October 2005   Contribution: 3    

RE: I have just started doing OOP design. My experienc...

Well. I found the answer myself. I am putting it here for the benefit of others.

State - districts is a 1-many relation (bi-directional relation).

here In Oops it becomes has a relations. So we have to design a state class which will contain a collection of ditricts as one of the attributes.

This is a bi-directional relation. So we have to design a distric class where a state class is denoted by means of an attribute.

State class will have getDistricts setDistricts addDistrict deleteDistrict methods

District class will have getState setState method


 
Is this answer useful? Yes | No
January 03, 2006 21:14:09   #2  
Nitin Gupta        

RE: I have just started doing OOP design. My experienc...

Alternatively what can also be done is create a connection class

class connection {

Vector leftNodes;

Vector rightNodes;

}

here leftNode will contain a state and rightNode will contain multiple districts. THis design support many-to-Many oneto-one and many-to-one and one to many relationships


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Hi friends,   There are 5 kind of storage classes  auto - : like int extern-: used by other class or programm static -: retain the value through out the executionof the programm register-: First memory storage.Secquence ...

Latest Answer : Abstract classes: They are modeled with their names in italicsStatic Members: They are modeled with an underline ...
Tags : Abstract

Latest Answer : It is possible to declare and define body functions in header files, there is no restrictions to create your all code inside a header file.SourceCode.c:#include "SourceCode.h"SourceCode.h:#include #include int Calc(int ...

Latest Answer :          Storage classes in c are :   Auto ,Extern,Static,Register,Volatile. ...

Latest Answer : in the header files Functions are decleared.  ...

Latest Answer : Generic classes are those which describe the functionality without being bound to any data type. These classes can be used to generate definitions of classes which are bound to a particular data type. A good example is an Array class. Functionality of ...

Latest Answer : Virtual base class is a term used in C++ multiple inheritance.Assume the following -- base class P. Two classes A and B derive from P. A third class C derives from both A and B.P has a protected variable pvar. A class C method accesses this variable. ...

I have just started doing OOP design. My experience has been in RDBMS. Where we work with tables, relation between them defined using foreign keys. Can anyone pl. help in designing classes for a simple case here. There are two tables (states, districts). Districts contains stateId as foreign key. So state to district 1-many relation is there. Such things how do we design in oops. Thanx in advance
Read Answers (2) | Asked by : sudha
Tags : RDBMS, OOPS

Latest Answer : By the use of BIOS coomands ..........Thanks ...
Read Answers (2) | Asked by : ONKAR

Latest Answer : OOPs is closer to real life representation of the objects which we want to program.Hierarchical relationships can be represented using inheriatnce. Data can be divided as public and private -- also we can provide interface for entering and validating ...
Read Answers (2) | Asked by : ritu
Tags : OOPS


 Sponsored Links

 
Related Articles

Linux Thin Client Networks Design and Deployment Review

Linux Thin Client Networks Design and Deployment Review Introduction This book is written by David Richards a veteran Linux thin client network designer Designed for System Administrators Linux Thin Client Networks Design and Deployment goes over the concepts which are related to thin client network
 

ODP.NET - Fundamental ODP.NET Classes to Retrieve Data

ODP NET Fundamental ODP NET Classes to Retrieve Data To retrieve data from an Oracle database using ODP NET we need to work with a few of the ODP NET classes At this point we will discuss the most fundamental classes available in ODP NET for retrieving data mosgoogle The following is the list of fun
 

Getting Started with Oracle and ODP.NET

ODP NET Developer’ s Guide by Jagadish Chatarji Pulakhandam Sunitha Paruchuri A practical guide for developers working with the Oracle Data Provider for NET and the Oracle Developer Tools for Visual Studio 2005 Application development with ODP NET Dealing with XML DB using ODP NET Oracle
 

How EDI work with XML

How EDI work with XML EDI and XML systems have been seen as the opportunity to create a holistic approach to data information exchange that can deliver and process simple durable and effective business transactions by electronic means To achieve this methods must be employed that are not only of val
 

Microsoft AJAX Library - C# and JavaScript Classes

C and JavaScript Classes For the purpose of demonstrating a few more OOP related concepts we ll use another class Our new class is named Table and it has two public fields rows columns and one method getCellCount The getCellCount method should return the number of rows multiplied by the number of co
 

Microsoft AJAX Library - JavaScript Classes

JavaScript Classes Not only can JavaScript functions contain other functions but they can also be instantiated This makes JavaScript functions a good candidate for implementing the concept of a class from traditional object oriented programming This is very helpful feature indeed because JavaScript
 

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960’ s The term object oriented programming’ was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

Service Oriented Design and Development

Service Oriented Design and Development SOAD Service Oriented Analysis and Design The term Service Oriented Analysis and Design  was first used in the publication Elements of Service Oriented Analysis and Design Service Oriented Analysis and Design is also covered in the publication Service
 

C++ Storage Classes

C Storage Classes In this C tutorial you will learn about storage classes types of storage class variables Automatic External and Static explained with examples mosgoogle center Storage classes In the context of scope of variables in functions exists the important concept of storage class What is St
 

C++ Objects and Classes

C Objects and Classes An Overview about Objects and Classes In object oriented programming language C the data and functions procedures to manipulate the data are bundled together as a self contained unit called an object A class is an extended concept similar to that of structure in C programming l
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape