Please update your Flash Player to view content.

Online Users

0 users and 342 guests online

Monthly Winners

  • images/stories/gifts/HariHara.jpg
  • images/stories/gifts/Hemalatha.jpg
  • images/stories/gifts/Mahesh.jpg
  • images/stories/gifts/MaheshGuptha.jpg
  • images/stories/gifts/Naresh.jpg
  • images/stories/gifts/Nithin.jpg
  • images/stories/gifts/Sudhir.jpg
  • images/stories/gifts/Usha.jpg
  • images/stories/gifts/gajavelly.jpg

Top Earners

Daily Toppers

Last Points Earned

Tech Shatabdhi Radio


Latest Updates

Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Certificates and points sent to August Winners.


Weekly toppers, star of the day modules added.


Win A Weekly Video Library Contest Started


Added 100% compatibility to all mobile phones


Interview Experiences module Added


Upcoming Events

No events found.
Sign in with Facebook

Video Comments

Redeem Points


Most Referral Users

Gowridevi
21
Nithin Mohan
12
BangaruBabu Pureti
8
DurgaPrasad
5
somanatha reddy.g
4
100% Non Commercial
Lets Help Lets Grow

Circles

All Friends
Welcome, Guest
Please Login or Register.    Lost Password?

Abstraction and Interface in C#
(1 viewing) (1) Guest
Hyderabad Techies Forum - C# .NET
Go to bottomPage: 123
TOPIC: Abstraction and Interface in C#
#2053
Abstraction and Interface in C# 1 Year, 11 Months ago Karma: 2
Abstraction

using System;
namespace MyNamespace
{
/// <summary>
/// Summary description for Abstract1.
/// </summary>
/// Abstract class
abstract class Abstract1
{
public Abstract1()
{
// TODO: Add constructor logic here
}
//non-abstract method
public void nonabmethod()
{
System.Console.WriteLine("Non Abstract Method!"Wink;
}
//abstract method
public abstract void abmethod(); //they are implicitly virtual it is not contain the body of the method
public static void Main()
{
myclass mycls = new myclass();
mycls.nonabmethod();
mycls.abmethod();
}
}
class myclass : Abstract1 //class derived from abstract class
{
public override void abmethod() //must implement the abstract method derived in class
{
System.Console.WriteLine("Abstract Method!"Wink;
}
}
}

using System;
namespace MyNamespace
{
/// <summary>
/// Summary description for Abstract2. Partial implementation of abstract class
/// </summary>
abstract class Abstract2
{
public static void Main()
{
myclass2 mycl = new myclass2();
mycl.method1();
mycl.method2();
}
public Abstract2()
{
// TODO: Add constructor logic here
}
public abstract void method1();
public abstract void method2();
}
abstract class myclass1 : Abstract2
{
public override void method1()
{
Console.WriteLine("Abstract Method #1"Wink;
}
}
class myclass2 : myclass1
{
public override void method2()
{
Console.WriteLine("Abstract Method #2"Wink;
}
}
}

using System;
namespace MyNamespace
{
/// <summary>
/// Summary description for Abstract3.
/// </summary>
/// abstract class derived from non abstract class
public class Abstract3
{
public static void Main()
{
mainclass mcl = new mainclass();
mcl.noabsmethod();
mcl.absmethod();
}
public Abstract3()
{
// TODO: Add constructor logic here
}
public void noabsmethod()
{
Console.WriteLine("Non-Abs class method"Wink;
}
}
abstract class absclass : Abstract3
{
public abstract void absmethod();
}
class mainclass : absclass
{
public override void absmethod()
{
Console.WriteLine("Abstract method call"Wink;
}
}
}

using System;
namespace MyNamespace
{
/// <summary>
/// Summary description for Abstract4.
/// </summary>
/// abstract class dervied from interface
public abstract class Abstract4 : myowninterface
{
public static void Main()
{
myclasses mc = new myclasses();
mc.IMethod();
}
public Abstract4()
{
// TODO: Add constructor logic here
}
public void IMethod()
{
Console.WriteLine("Method implementation from interface"Wink;
}
}
interface myowninterface
{
void IMethod();
}
class myclasses : Abstract4
{
}
}

using System;
namespace MyNamespace
{
/// <summary>
/// Summary description for Abstract5.
/// </summary>
public abstract class Abstract5
{
public static void Main()
{
Abstract5 abs = new baseclass(); // Polymorphism
abs.method();
abs.method1();
}
public Abstract5()
{
// TODO: Add constructor logic here
}
public abstract void method();
public abstract void method1();
}
class baseclass : Abstract5
{
public override void method()
{
Console.WriteLine("Abstract Method1 of baseclass"Wink;
}
public override void method1()
{
Console.WriteLine("Abstract Method2 of baseclass"Wink;
}
}
}

Interface:
using System;
namespace MyNamespace
{
/// <summary>
/// Summary description for Interface1.
/// </summary>
public class Interface1 : myinterface
{
public static void Main()
{
Interface1 inf1 = new Interface1();
inf1.callmethod();
}
public Interface1()
{
// TODO: Add constructor logic here
}
public void callmethod()
{
Console.WriteLine("callmethod implemented!"Wink;
}
}
interface myinterface
{
void callmethod();
}
}

using System;
namespace MyNamespace
{
/// <summary>
/// Combining Interfaces
/// </summary>
public class Interface2 : combineinterface
{
public static void Main()
{
Interface2 inf2 = new Interface2();
inf2.show();
inf2.display();
}
public Interface2()
{
// TODO: Add constructor logic here
}
public void show()
{
Console.WriteLine("Show Method Call!"Wink;
}
public void display()
{
Console.WriteLine("Dislay Method Call!"Wink;
}
}
interface myinterface1
{
void show();
}
interface myinterface2
{
void display();
}
interface combineinterface : myinterface1, myinterface2
{
}
}

using System;
namespace MyNamespace
{
public class Interface3 : interdemo
{
public static void Main()
{
Interface3 inf3 = new Interface3();
inf3.show();
if (inf3 is interdemol)
{
interdemol id = (interdemol)inf3;
bool ok = id.display();
Console.WriteLine("Method implmented"Wink;
}
else
{
Console.WriteLine("Method not implmented"Wink;
}
}
public Interface3()
{
// TODO: Add constructor logic here
}
public bool show()
{
Console.WriteLine("Show method call"Wink;
return true;
}
}
interface interdemo
{
bool show();
}
interface interdemol
{
bool display();
}
}

using System;
namespace MyNamespace
{
public class Interface4 : inf1, inf2
{
public static void Main()
{
Interface4 infobj = new Interface4();
}
public Interface4()
{
// TODO: Add constructor logic here
}
void inf1.show12()
{
Console.WriteLine("call show method1!"Wink;
}
void inf2.show12()
{
Console.WriteLine("call show method2!"Wink;
}
}
interface inf1
{
void show12();
}
interface inf2
{
void show12();
}
interface inf : inf1, inf2
{
}
}
meetdine (User)
Platinum Boarder
Posts: 801
graph
Points: 162420
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#2068
Re: Abstraction and Interface in C# 1 Year, 11 Months ago Karma: 3
Hi,

Very useful info!!!!!
harshitha (User)
Gold Boarder
Posts: 285
graphgraph
Points: 109942
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
Phani harshitha Madala
blog:www.phmadala.wordpress.com
Follow me on twitter:www.twitter.com/phaniharshitha
 
#2072
Re:Abstraction and Interface in C# 1 Year, 11 Months ago Karma: 0
hi dinesh

good one
venkatp (User)
Platinum Boarder
Posts: 334
graphgraph
Points: 135821
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#2075
Re:Abstraction and Interface in C# 1 Year, 11 Months ago Karma: -1
thanks for sharing
dayasagar (User)
Platinum Boarder
Posts: 529
graphgraph
Points: 115405
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#2134
Re: Abstraction and Interface in C# 1 Year, 11 Months ago Karma: 1
Thanks for sharing
surekha.ch20 (User)
Platinum Boarder
Posts: 646
graphgraph
Points: 80521
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#2156
Re:Abstraction and Interface in C# 1 Year, 11 Months ago Karma: 0
Great thanks for sharing.
basettysri (User)
Platinum Boarder
Posts: 784
graphgraph
Points: 142144
graphgraph
User Offline Click here to see the profile of this user
Gender: Male srinivasulubasetty basettysri sribasetty Location: Hyderabad Birthday: 09/27
The administrator has disabled public write access.
Thanks,
Srinivasulu Basetty
 
Go to topPage: 123
Moderators: chandu, harihara.muvvala, usham