urgent plz

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 128
Reputation: sivak has a little shameless behaviour in the past 
Solved Threads: 0
sivak sivak is offline Offline
Junior Poster

urgent plz

 
0
  #1
Nov 10th, 2008
can any one telll me the answer soon
1.i dint get clear idea about abstract class and interfaces in c#? when we go for abstract class and interface in c# .net? explain with coding example
2.explain about staic mathoda with example...
3.i have 1000 records in my database...want to dispaly only a particular record like 501 to525 th record only...can u tell me is there any query or something......
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 138
dickersonka dickersonka is offline Offline
Veteran Poster

Re: urgent plz

 
0
  #2
Nov 11th, 2008
show what you don't understand, but here is a quick rundow

1. abstract classes are used for common functionality, but can have implementation, interfaces cannot

2. static does not require you to create an instance of the class to call it

3. select * from table where id >= 501 and id <= 525
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 128
Reputation: sivak has a little shameless behaviour in the past 
Solved Threads: 0
sivak sivak is offline Offline
Junior Poster

Re: urgent plz

 
0
  #3
Nov 11th, 2008
Originally Posted by sivak View Post
can any one telll me the answer soon
1.i dint get clear idea about abstract class and interfaces in c#? when we go for abstract class and interface in c# .net? explain with coding example
2.explain about staic mathoda with example...
3.i have 1000 records in my database...want to dispaly only a particular record like 501 to525 th record only...can u tell me is there any query or something......
hi every one ..
i wnat abstract class and interface with real time example...anyone explain with coding example?
2.i have 1000 records in my database...want to dispaly only a particular record like 501 to525 th record only.(query ok ) ..they asked me using dridview how to retrieve?
3.explain class with example?
i am stuggling for oops concept ..plz help me
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: urgent plz

 
0
  #4
Nov 11th, 2008
thank you for sending me a private message for which I didnt want.

Please use google, there are countless examples out there..
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,024
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 300
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Postaholic

Re: urgent plz

 
0
  #5
Nov 11th, 2008
Let's say you tell me : "I have a boat."
The first thing I would ask : "What kind of a boat?"
All boats have things in common, so if I wanted a boat class I would make it abstract so that I cannot do
boat myboat = new boat();
but that I can make a sailboat class(which derives from the abstract boat-class)
class sailboat : boat
{
}

And now I can do
sailboat mysailboat = new sailboat();
mysailboat can use all the methods and properties etc. of the boat class.
But I never allow an instance of the boat class to exist on it's own, because it is to vague.
Last edited by ddanbe; Nov 11th, 2008 at 8:35 am.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 138
dickersonka dickersonka is offline Offline
Veteran Poster

Re: urgent plz

 
0
  #6
Nov 11th, 2008
abstract classes vs interface, if you can't find that on google, your computer must not be working

http://www.codeproject.com/KB/cs/abs...nterfaces.aspx

gridview paging
http://www.codeproject.com/KB/webfor...tomPaging.aspx
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 172
Reputation: Jugortha is an unknown quantity at this point 
Solved Threads: 16
Jugortha Jugortha is offline Offline
Junior Poster

Re: urgent plz

 
0
  #7
Nov 12th, 2008
There are a didderence between abstract classes and interfaces, the abstrac classes are used to derive new objects, like humanoid that we could use to derive Persons, Monkey chid types

public class Humaoid
{
public Humanoid(){}
public void StandOnTwoFeet(){}
public void Walk()
{
//TO DO some code implementations here
}
}

public class Persons : Humaoid
{
public override Humanoid(){}
public override void StandOnTwoFeet(){}
public override void Walk()
{
//TO DO some code implementations here
}
}

Abstract classes are used to employ polymorphism only between types who belong to the same family

Abstract classes familly members(methods, properties, fields, events) can use accessors like public private, protected

Abstract classes could have some of their method implemented with code

Now move to the interfaces

Persons and girafes are both mamifers but they don't belong to the same type as the persons belong to the Humonoids and the girafes belong to the Antilops

public Interface IMamifer
{
bool IsMamifer();
}

public Person: Humonoid, IMamifer
{
public override Humanoid(){}
public override void StandOnTwoFeet(){}
public override void Walk()
{
//TO DO some code implementations here
}

// The interface method
public bool IsMamifer()
{return true;}

}

public Girafe: Antilops, IMamifer
{
public override Humanoid(){}
public override void StandOnTwoFeet(){}
public override void Walk()
{
//TO DO some code implementations here
}

// The interface method
public bool IsMamifer()
{return true;}
}


Interfaces' members coudn't be implemented with code within the Interface scope, they coudn't use accessors like public private..... and they could tie between different types those have something in common

Now, you tell me give me a real use case where exactly the interfaces are useful as the abstract classes are used to derive new types so what about the interfaces???

Ok

Imagine that you want to select all earth mamifers from the other existed types and put them in a given list, recall that mamifers are dispatched in more than one type

foreach(IMamifer creature in Earth.Creature)
{
List.Items.Add(creature);
}

instead of


foreach(Person creature in Earth.Creature)
{
List.Items.Add(creature);
}

foreach(Girafe creature in Earth.Creature)
{
List.Items.Add(creature);
}

.
.
.
And the list is so long all those could be replaced by the first loop
Last edited by Jugortha; Nov 12th, 2008 at 8:01 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 128
Reputation: sivak has a little shameless behaviour in the past 
Solved Threads: 0
sivak sivak is offline Offline
Junior Poster

Re: urgent plz

 
0
  #8
Nov 15th, 2008
hi Jugortha
really thank u so much for ur mail ...i got clear ideas about interface method.....u dint mention any abstract keyword in ur example...how we can justify its abstrct one? plz tell me ..sorry to dist u
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 172
Reputation: Jugortha is an unknown quantity at this point 
Solved Threads: 16
Jugortha Jugortha is offline Offline
Junior Poster

Re: urgent plz

 
0
  #9
Nov 15th, 2008
Good question!!!

if just a method or a member that is not implemented yet means that this class is abstract without need to use any other keywords to indicate that a given class is abstract for example


public class X
{
public int Method1(...)
{
//Here code implementation
}
public int Method2(...)
{
//Here code implementation
}



public int Methodk(...){}



public int Methodn-1(...)
{
//Here code implementation
}
public int Methodn(...)
{
//Here code implementation
}
}

this class is abstract as the rank k method is not implemented so it is abstract class and you can't directly instanciate it

you have to derive it and override the rank k method


public class Y
{
public type method1(){}
public type method2(){}
public type method3(){}
}

Is also abstract without any keyword to indicatethat is abstract

at the contrast

if you want that a class doesn't derived any more then you use the keyword sealed

public sealed class Y
{
barwet barwet .......
}

This class will not be derived any more and if you try to derive a type from it you will recieve an error as it is marked as sealed

so, if you are satisfied please mark this thread as solved, thanks
Last edited by Jugortha; Nov 15th, 2008 at 2:46 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 128
Reputation: sivak has a little shameless behaviour in the past 
Solved Threads: 0
sivak sivak is offline Offline
Junior Poster

Solved :-)

 
0
  #10
Nov 16th, 2008
SOLVED
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC