Extented Datagrid, Enter press move next cell
Wednesday, November 23, 2011 Category : C-sharp.NET 0
A free source of help.
Home > 2011
Wednesday, November 23, 2011 Category : C-sharp.NET 0
Tuesday, November 22, 2011 Category : C-sharp.NET 0
Interface:
–> If your child classes should all implement a certain
group of methods/functionalities but each of the child classes is free
to provide its own implementation then use interfaces.
For e.g. if you are implementing a class hierarchy for vehicles
implement an interface called Vehicle which has properties like Colour
MaxSpeed etc. and methods like Drive(). All child classes like Car
Scooter AirPlane SolarCar etc. should derive from this base interface
but provide a seperate implementation of the methods and properties
exposed by Vehicle.
–> If you want your child classes to implement multiple unrelated functionalities in short multiple inheritance use interfaces.
For e.g. if you are implementing a class called SpaceShip that
has to have functionalities from a Vehicle as well as that from a UFO
then make both Vehicle and UFO as interfaces and then create a class SpaceShip that implements both Vehicle and UFO .
Abstract Classes
–> When you have a requirement where your base class should
provide default implementation of certain methods whereas other methods
should be open to being overridden by child classes use abstract
classes.
For e.g. again take the example of the Vehicle class above. If
we want all classes deriving from Vehicle to implement the Drive()
method in a fixed way whereas the other methods can be overridden by
child classes. In such a scenario we implement the Vehicle class as an abstract class
with an implementation of Drive while leave the other methods /
properties as abstract so they could be overridden by child classes.
–> The purpose of an abstract class is to provide a common definition of a base class that multiple derived classes can share.
For example a class library may define an abstract class
that is used as a parameter to many of its functions and require
programmers using that library to provide their own implementation of
the class by creating a derived class.
GoodReceiveID
|
CartonNo
|
1
|
1,2,3
|
2
|
1,5,7
|
1
|
4,5
|
1
|
6,7
|
2
|
2,3
|
GoodReceiveID
|
'CartonList'
|
1
|
1,2,3,4,5,6,7
|
Monday, November 21, 2011 Category : C-sharp.NET 0
public delegate void afterButtonClick();
public event afterButtonClick onButtonClick;
private void btnSubmit_Click(object sender, EventArgs e)
{
if (onButtonClick != null)
{
onButtonClick();
}
}
Use this code on Class , like custom control , when use this control you will find your event on event list of this control.
Tuesday, October 25, 2011 Category : Xcode Iphone 0
My XML Have Following pattern
<Party>
<Player>
<Name>Butch</Name>
<Level>1</Level>
<Class>Fighter</Class>
</Player>
<Player>
<Name>Shadow</Name>
<Level>2</Level>
<Class>Rogue</Class>
</Player>
<Player>
<Name>Crak</Name>
<Level>3</Level>
<Class>Wizard</Class>
</Player>
</Party>
So i have root node Party and a Child Node Player
After parsing XML i will be used two class for store data in memory. here is the two class
Monday, October 24, 2011 Category : Xcode Iphone 0
Polymorphism is the ability of an object of one class to appear and be used as an object of another class. This is usually done by creating methods and attributes that are similar to those of another class.
// file: Animal.h #import <Foundation/Foundation.h> @interface Animal : NSObject { NSString *name; } @property(copy) NSString *name; -(id) initWithName: (NSString *) aName; -(void) talk; @end // ============================= // file: Animal.m #import "Animal.h" @implementation Animal @synthesize name; -(id) initWithName:(NSString *)aName { self = [super init]; if ( self ) self.name = aName; return self; } -(id) init { return [self initWithName:@""]; } -(void) talk { NSLog(@"%@: Animals cannot talk!", name); } -(void) dealloc { if ( name ) [name release]; [super dealloc]; } @end // ============================= // file: Cat.h #import "Animal.h" @interface Cat : Animal -(void) talk; @end // ============================= // file: Cat.m #import "Cat.h" @implementation Cat -(void) talk { NSLog(@"%@: Meow!", name); } @end // ============================= // file: Dog.h #import "Animal.h" @interface Dog : Animal -(void) talk; @end // ============================= // file: Dog.m #import "Dog.h" @implementation Dog -(void) talk { NSLog(@"%@: Woof! Woof!", name); } @end // ============================= // file: main.m #import <Foundation/Foundation.h> #import "Animal.h" #import "Cat.h" #import "Dog.h" int main (int argc, const char * argv[]) { // all instances are behind a superclass type (Animal) Animal *animal = [[Animal alloc] initWithName:@"Animal"]; Animal *missy = [[Cat alloc] initWithName:@"Missy"]; Animal *mr = [[Cat alloc] initWithName:@"Mr. Mistophelees"]; Animal *lassie = [[Dog alloc] initWithName:@"Lassie"]; // polymorphic behavior [animal talk]; [missy talk]; [mr talk]; [lassie talk]; // releasing memory [animal release]; [missy release]; [mr release]; [lassie release]; return 0; } // ============================= // --> Console output: // Animal: Animals cannot talk! // Missy: Meow! // Mr. Mistophelees: Meow! // Lassie: Woof! Woof!
Powered by Blogger | Theme mxs | Converted by LiteThemes.com