Announcement

Collapse
No announcement yet.

Interfaces

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interfaces

    interface_sample
    PHP Code:
    public interface interface_sample {

        
    void method1 ();
        
    void method2 ();
        
    void method3 ();
        
    void method4 ();



    interface_implemented
    PHP Code:
    public class interface_implemented implements interface_sample {

        public 
    void method1() {
            
    /// method
        
    }

        public 
    void method2() {
            
    /// method
        
    }

        public 
    void method3() {
            
    /// method
        
    }

        public 
    void method4() {
            
    /// method
        
    }


    SampleObject
    PHP Code:
    public class SampleObject {
        
    SampleObject(interface_sample obj){

            
    // do something
        
    }





    main
    PHP Code:
    public class test {

        public static 
    void main(String[] input){

            
    SampleObject sample = new SampleObject( new interface_implemented());

            
    // SampleObject wants an object with methods described in the interface_sample
            // interface_implemented is a class that implements the interface_sample
            // the new interface_implemented object can be passed to the SampleObject constructor


        
    }


    | VFX Artist, C++ Programmer, HW Overclocker | Web: xgiovio.com Email: xgiovio@gmail.com Twitter: @xgiovio
Working...
X

Google Profile


My name is Giovanni Di Grezia, but people call me xgiovio.

Here is my homepage:.

I'm a VFX Artist and Software Developer.

Giovanni Di Grezia