Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Abstract class and Interface related of same methods we are extednind in class...... [modified]

Abstract class and Interface related of same methods we are extednind in class...... [modified]

Scheduled Pinned Locked Moved C#
databasetutorial
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Roney
    wrote on last edited by
    #1

    Hi all, This is simple thinking concept query is that-I've an one abstract class that contain some method test() and i've one interface in that with same signature of abstract class method test() name ok fine.(they are just declared) now i want to implement in one class. And i called and provided some functionalities to the 2 methods, 1 is from abstract class and 1 is from interface . so how to call particular interface method with the class object that we are implemented in the class and how to call abstract class method with the class object.- bcoz are 2 same named methods and with the signature also same..........so how would know when we are declared object for class and calling some obj.test()-which method will displayed-is it from abstract or interface belonged method. can u plz give me reply very soon............

    modified on Thursday, October 9, 2008 2:50 AM

    W 1 Reply Last reply
    0
    • R Roney

      Hi all, This is simple thinking concept query is that-I've an one abstract class that contain some method test() and i've one interface in that with same signature of abstract class method test() name ok fine.(they are just declared) now i want to implement in one class. And i called and provided some functionalities to the 2 methods, 1 is from abstract class and 1 is from interface . so how to call particular interface method with the class object that we are implemented in the class and how to call abstract class method with the class object.- bcoz are 2 same named methods and with the signature also same..........so how would know when we are declared object for class and calling some obj.test()-which method will displayed-is it from abstract or interface belonged method. can u plz give me reply very soon............

      modified on Thursday, October 9, 2008 2:50 AM

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Quick answer: Interfaces do not have implementations, classes do. So you don't have two different methods.

      The need to optimize rises from a bad design

      R 1 Reply Last reply
      0
      • W Wendelius

        Quick answer: Interfaces do not have implementations, classes do. So you don't have two different methods.

        The need to optimize rises from a bad design

        R Offline
        R Offline
        Roney
        wrote on last edited by
        #3

        I mean that interface has only signature method that method name test(),similarly abstract class has same method test() with same signature of interface.That 2 methods are just declared. Now in my class i provided functionalities for those methods by inheriting both abstract and interface. Up to this okey ,now i declared one object for class calling method test() with that object.........so which method will be called ........either abstract class method or interface method. and why do u get that

        W 1 Reply Last reply
        0
        • R Roney

          I mean that interface has only signature method that method name test(),similarly abstract class has same method test() with same signature of interface.That 2 methods are just declared. Now in my class i provided functionalities for those methods by inheriting both abstract and interface. Up to this okey ,now i declared one object for class calling method test() with that object.........so which method will be called ........either abstract class method or interface method. and why do u get that

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          Okay, Few things: You inherit from abstract class, meaning you get some functionality. You don't inherit from interface, you implement it. This means, that when you implement an interface, you must write the implementation logic for the method defined in an interface. In your situation, the abstract class may create the implementation for the interface or if the abstract class doesn't do that, you must do it in inherited class Mika

          The need to optimize rises from a bad design

          R 1 Reply Last reply
          0
          • W Wendelius

            Okay, Few things: You inherit from abstract class, meaning you get some functionality. You don't inherit from interface, you implement it. This means, that when you implement an interface, you must write the implementation logic for the method defined in an interface. In your situation, the abstract class may create the implementation for the interface or if the abstract class doesn't do that, you must do it in inherited class Mika

            The need to optimize rises from a bad design

            R Offline
            R Offline
            Roney
            wrote on last edited by
            #5

            Sorry u could n't get my question. First i want to inheritance and implements methods of abstract class and interface(But here the 2 one is abstract class contain test() method,other one interface contain test() method. both are same in signature.) so I did inheritance and implementation for abstract class and interface in the class.Up to here fine...when declare a object for class and calling test() method with the class object so which of method will be called in the class ,either from implemented interface method or abstract class method.Bcoz they have same signature of two methods that is why am asking.

            W 1 Reply Last reply
            0
            • R Roney

              Sorry u could n't get my question. First i want to inheritance and implements methods of abstract class and interface(But here the 2 one is abstract class contain test() method,other one interface contain test() method. both are same in signature.) so I did inheritance and implementation for abstract class and interface in the class.Up to here fine...when declare a object for class and calling test() method with the class object so which of method will be called in the class ,either from implemented interface method or abstract class method.Bcoz they have same signature of two methods that is why am asking.

              W Offline
              W Offline
              Wendelius
              wrote on last edited by
              #6

              Could you post the code or simplified sample. This would greatly help me to see the issue.

              The need to optimize rises from a bad design

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups