class DocBond%(CustomLoadFunction = @ldfun) DocBond
    isa DocAsset
    properties
        FaceValue@double = 0;
        Yield@double = 0;
        CurrentBondYield@double = 0;
        
    methods
        function b = DocBond(description,face_value,yield,current_yield)
           if current_yield <= 0 || yield <= 0
                market_value = face_value;
           else
                market_value = face_value*yield/current_yield;
           end
            construct b using DocAsset(description,'bond',market_value);
            b.FaceValue = face_value;
            b.Yield = yield;
            b.CurrentBondYield = current_yield;
        end % DocBond
        
        function disp(b)
        % Display DocBond object
            DocAsset@disp(b)  
            fprintf('Face value of bonds: $%g\nYield: %3.2f%%\n',...
            b.FaceValue,b.Yield);
        end % disp
 
       function b = ldfun(obj)
            disp('got here')
            class (obj)
            b = obj;
        end
    
            

   methods (Static = true)
        function market_value = calc_value(face_value,yield,current_yield)
        % check for bad value interest rates and calculate
        % a current market value based on simple calculation
            if current_yield <= 0 || yield <= 0
                market_value = face_value;
           else
                market_value = face_value*yield/current_yield;
           end
        end % calc_value
end % class 

 
