Archives

All posts for the year 2019

casopis_om_1
casopis_om_2
casopis_om_3


The Journal is into the articles from the sphere of general medicine and other medical disciplines which might be of interest to General/Family medicine. 

The Section of General Medicine of the Serbian Medical Society is the founder, owner, and publisher of the Journal Opsta medicina.

http://www.generalpracticejournal.org

http://www.casopisopstamedicina.org

Abstract Factory provide common interface for a group of similar classes, without creating concrete class.

public interface IClass{
          public string GetMethodResult();
} 
public class ClassA : IClass{
         public string GetMethodResult(){
                return "Result from Class A";
         }
}

public class ClassB : IClass {
        public string GetMethodResult(){
               return "Result from Class B";
        }
}

public interface IFactory{
          public IClass CreateClass();
}

public class ClassFactoryA : IFactory{
         public IClass CreateClass(){
                return new ClassA();
         }
}


public class ClassFactoryB : IFactory {
        public IClass CreateClass(){
               return new ClassB();
        }
}

public enum ClassType {
       Class_A, Class_B
} 

void Main{
       IFactory factory;
       switch(type){
           case type.Class_A:
                factory = new ClassFactoryA();
           case type.Class_B:
                factory = new ClassFactoryB();
        }
       var aClass = factory.CreateClass();
       var result = aClass.GetMethodResult();
        
} 

Define an interface for creating an object, but let sub-classes decide which class to instantiate. Factory Method lets a class defer instantiation to sub-classes.

That means, You can create a object without specifying exact class, by using /calling factory method.

public interface ISubClass{
          public string GetMethodResult();
} 


public class ClassA : ISubClass {
         public string GetMethodResult(){
                return "Result from Class A";
         }
}


public class ClassB : ISubClass {
        public string GetMethodResult(){
               return "Result from Class B";
        }
}

public enum ClassType {
       Class_A, Class_B
} 

public class ClassFactory{
       public ISubClass GetClass(ClassType type){
               switch(type){
                    case type.Class_A:
                             return new ClassA();
                    case type.Class_B:
                             return new ClassB();
                }
        }
} 
tijanapavlovic_1
tijanapavlovic_3
tijanapavlovic_2

New interesting blog with stunning stories.

http://www.tijanapavlovic.com

savyva_sajt_1
savyva_sajt_6
savyva_sajt_3
savyva_sajt_7
savyva_sajt_4
savyva_sajt_5

Two websites for Savyva company.

Still in progress: avyva.com

Beta version: beta.savyva.com