Click here to Skip to main content
15,890,186 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
QuestionC# teamwork coding style Pin
comiscience5-Jan-14 23:09
comiscience5-Jan-14 23:09 
AnswerRe: C# teamwork coding style Pin
Eddy Vluggen6-Jan-14 12:42
professionalEddy Vluggen6-Jan-14 12:42 
GeneralRe: C# teamwork coding style Pin
comiscience6-Jan-14 20:19
comiscience6-Jan-14 20:19 
GeneralRe: C# teamwork coding style Pin
Eddy Vluggen7-Jan-14 9:27
professionalEddy Vluggen7-Jan-14 9:27 
GeneralRe: C# teamwork coding style Pin
comiscience7-Jan-14 20:41
comiscience7-Jan-14 20:41 
AnswerRe: C# teamwork coding style Pin
Pete O'Hanlon7-Jan-14 22:46
mvePete O'Hanlon7-Jan-14 22:46 
GeneralRe: C# teamwork coding style Pin
comiscience7-Jan-14 23:02
comiscience7-Jan-14 23:02 
QuestionBase class method access VS. abstract class Method access Pin
netfed4-Jan-14 22:28
netfed4-Jan-14 22:28 
Refering to the following two pair of classes:

public class Person
    {
        protected string ssn = "444-55-6666";
        protected string name = "John L. Malgraine";

        public virtual void GetInfo()
        {
            Console.WriteLine("Name: {0}", name);
            Console.WriteLine("SSN: {0}", ssn);
        }
    }
    class Employee : Person
    {
        public string id = "ABC567EFG";
        public override void GetInfo()
        {
            // Calling the base class GetInfo method: 
            base.GetInfo();
            Console.WriteLine("Employee ID: {0}", id);
        }
    }
//---------------------------------------------------------
    public abstract class animal
    {
        protected string ssn = "Poultry";
        protected string name = "Mostly flying creatures";

        public abstract void GetInfo();
    }
    class Seagull : animal
    {
        public string id = "ABC567EFG";
        public override void GetInfo()
        {
            // Calling the base class GetInfo method: 
            Console.WriteLine("Name: {0}", name);
            Console.WriteLine("SSN: {0}", ssn);
            Console.WriteLine("Specimen ID: {0}", id);
        }
    }


Implementing them:

Public class A2Implementation {

 public A2Implementation()
        {
 // This is base class access  of the getinfo() method
            Employee E = new Employee();
            E.GetInfo();
            // The following is abstract class access of the getinfo() method
            // animal A = new animal();   // this would be wrong (instantiating it) instead, (if I were to use this) use a derive-keyword on this implementing class
            Seagull A = new Seagull();
            A.GetInfo(); // getinfo() is accessed through the Seagull class
}


Question

I get the exact same result in the implementation of the two pairs (unclear, albeit intentionally).
Now what are the pros and cons of using an abstract definition here (the animal-Seagull track), or what is best; just using ordinary base class Access (the Person-Employee track)?

Could I be mistaken in assuming that there is a concordance here.

modified 5-Jan-14 4:48am.

AnswerRe: Base class method access VS. abstract class Method access Pin
Kornfeld Eliyahu Peter5-Jan-14 2:14
professionalKornfeld Eliyahu Peter5-Jan-14 2:14 
GeneralRe: Base class method access VS. abstract class Method access Pin
netfed5-Jan-14 3:01
netfed5-Jan-14 3:01 
AnswerRe: Base class method access VS. abstract class Method access Pin
Kornfeld Eliyahu Peter5-Jan-14 3:17
professionalKornfeld Eliyahu Peter5-Jan-14 3:17 
AnswerRe: Base class method access VS. abstract class Method access Pin
Shameel6-Jan-14 3:53
professionalShameel6-Jan-14 3:53 
GeneralRe: Base class method access VS. abstract class Method access Pin
netfed9-Jan-14 2:49
netfed9-Jan-14 2:49 
GeneralRe: Base class method access VS. abstract class Method access Pin
Richard MacCutchan9-Jan-14 4:43
mveRichard MacCutchan9-Jan-14 4:43 
AnswerRe: Base class method access VS. abstract class Method access Pin
Shameel10-Jan-14 3:36
professionalShameel10-Jan-14 3:36 
GeneralRe: Base class method access VS. abstract class Method access Pin
netfed12-Jan-14 0:51
netfed12-Jan-14 0:51 
GeneralRe: Base class method access VS. abstract class Method access Pin
Ron Beyer12-Jan-14 4:33
professionalRon Beyer12-Jan-14 4:33 
GeneralRe: Base class method access VS. abstract class Method access Pin
netfed12-Jan-14 6:17
netfed12-Jan-14 6:17 
GeneralRe: Base class method access VS. abstract class Method access Pin
Ron Beyer12-Jan-14 6:40
professionalRon Beyer12-Jan-14 6:40 
GeneralRe: Base class method access VS. abstract class Method access Pin
Shameel12-Jan-14 4:54
professionalShameel12-Jan-14 4:54 
AnswerRe: Base class method access VS. abstract class Method access Pin
Keld Ølykke9-Jan-14 14:33
Keld Ølykke9-Jan-14 14:33 
GeneralRe: Base class method access VS. abstract class Method access Pin
netfed12-Jan-14 1:16
netfed12-Jan-14 1:16 
GeneralRe: Base class method access VS. abstract class Method access Pin
Keld Ølykke12-Jan-14 8:06
Keld Ølykke12-Jan-14 8:06 
QuestionImplementation of Loose Coupling Pattern Pin
User 905247816-Dec-13 14:41
User 905247816-Dec-13 14:41 
AnswerRe: Implementation of Loose Coupling Pattern Pin
Antonio Ripa27-Dec-13 2:25
professionalAntonio Ripa27-Dec-13 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.