Hi guys,
I am facing the interviews, always getting new things. But I want to know what are the most tricky question based on OOPS, C# and dot net with there answer.
May be this thread will helpful to all who really willing to get knowledge.
...
While reviewing rather old code I found some strange design decision:
// irrelevant stuff removed
class Class {
public:
int GetStage() const { return stage; }
void SetStage( int value ) { stage = value; }
private:
int stage;
};
void ProgressStage( Class* object )
{
int stage = object->GetStage();
assert( stage < MaxSta...
Let's say that in a project your entire domain can be modelled with a single root say "Company". So is it logical then to say that my DAL exposes only 2 methods :- save and delete to the business layer and all other things are done at business layer ?? or is it bad design ??
Context : I am new to ORM and am currently involved in a projec...
hi all,
i've got a small scenario to call fucntions in two different classes.
i have two classes names firstClass.m and secondClass.m
i want to call class1.m from class2.m
secondClass
method
{ variables 1 & 2;
call method in class1
}
firstClass
method
{
NSLog("printing variables 1 & 2 of secondClass.m"); }
i want to knw h...
I've run into an organizational problem with an application I am working on, on the Android platform. The application uses sensors as input and OpenGL as output.
The traditional method is something
like organizing the project into an
MVC where I have the main activity
class load an OpenGL view and a
sensor handling class and will then...
I'm working on a project where I have to take data from one source and translate/tweak it so that it can be properly consumed by a different source, in this case, the database. I imagine this is a fairly common problem, and while I believe I'm off to a good start, I'm stuck as to how best to implement the middle part of the solution tha...
What is better in my application (called MyApp) that has the following 2 classes. MyApp is a multithreaded application requiring ClassA and ClassB. Also ClassA and ClassB spawn P-threads. The underlying system is Linux and the logging library used is Apache's Log4CXX.
//ClassA:
LoggerPtr ClassA::logger(Logger::getLogger("ClassA"));
//C...
Is the Visitor Pattern the fastest way to accomplish method parameter type identification (effectively single dispatch on a parameter, not a member's class) in C++? I might know the exact method(s) I want to invoke on elements of not-yet-know subtype, so invariably making an additional virtual method call like V::visit(A *) in A::accept...
Program design:
Class A, which implements lower level data handling
Classes B-E, which provide a higher level interface to A to perform various functions
Class F, which is a UI object that interacts with B-E according to user input
There can only be one instantiation of A at any given time, to avoid race conditions, data corrupti...
I have a Perl module (Module.pm) that initializes a number of variables, some of which I'd like to import ($VAR2, $VAR3) into additional submodules that it might load during execution.
The way I'm currently setting up Module.pm is as follows:
package Module;
use warnings;
use strict;
use vars qw($SUBMODULES $VAR1 $VAR2 $VAR3);
requi...
Hello, I've recently became interested in proper OOP design in web applications. I think I understand most of the principles and design patterns but sometimes I have problem with putting them into practice.
I use MVC and I think I am able to design controllers and views in OOP way. The problem I face is with models. I'm particularly obs...
Hi,
I wish I could return an object of virtual base class so that I won't need to deal with the memory management(the idea of function programming also stimulate this pursuit). That means I am looking for some things like below:
class Car
{
public:
virtual int price() = 0 ;
virtual string brand() = 0 ;
}
class Interface
{
...
Hi,
Consider the following code:
public class Vehicle
{
public void StartEngine()
{
// Code here.
}
}
public class CityBus : Vehicle
{
public void MoveToLocation(Location location)
{
////base.StartEngine();
this.StartEngine();
// Do other stuff to drive the bus to the new location.
...
I have many T arrays to read.
Each T array can represent data of type A, B or C.
A: A list of T
B: A single T
C: Exactly three T
When I read a T array, I will be able to get a list of T, and determine by reading the first T in the list whether it's of type A, B or C.
I thought of two possible approaches and would like to know their meri...
<?php
class test{
function foo(){
echo $this->abc;
}
}
$test = new test;
$test->abc = 'abc';
?>
Remeber that i don't declare the variable abc, but i want to set $abc to 'abc'. How to do this
Sorry because this is a dummy question
...
I am creating a population genetics simulation system in JRuby.
I have created classes such as Allele, Gene, Organism, Population.
A Population object contains multiple Organism objects (in an array), each Organism object contains multiple Genes, and so on.
Currently, it is very easy to know, for example, what Gene objects a certain ...
I am a complete noob to android but I have been programing c# for a long time. I am writing an android application and have gotten to a point where the c# programmer in me wants to start creating a loosely coupled design and and moving code into different layers, using interfaces, etc.
But then I stumble upon the Designing for performa...
Object-Relational Mapping, ORM is a problem that has to be solved in all applications that is implemented in an object oriented programming language and use a relational database.
But isn't the problem the same if you are using structs to map relational databases in C? And tuples/records in a functional programming language? Or am I mis...
I'm recently getting a bit confused with interfaces and abstract classes and I feel I dont fully grasp it like I thought I did. I think I'm using them incorrectly. I'll describe what I'm doing at the moment, the problem I have faced, and then hopefully it be clear what I'm doing wrong if anything.
I wanted to write some classes that do ...
I have read that this should be avoided, though I can't recall the source. Inheritance should used with abstract classes in the middle of the hierarchy, and concrete classes showing only as leaves.
Where can I find a good explanation of the reasoning behind this? (Opposite opinions are also welcome)
...