Code covered by the BSD License  

Highlights from
Comparison of C++ and MATLAB Using Object Oriented Application Example

image thumbnail

Comparison of C++ and MATLAB Using Object Oriented Application Example

by

 

28 Feb 2008 (Updated )

Wireless Communications Application Example Used to Compare C++ and MATLABĀ® Code

Receiver
% Receiver Class
%
% Copyright 2008-2009 The MathWorks, Inc

% C++ Code
%{
#include <math.h>
#include "basetype.h"
#include "util.h"

class Receiver {
    Receiver::Receiver()
    {
    protected:
    int m_bitrate;  // Bitrate in Mb/s
    }

    int
    Receiver::bitrate() const {     // Bitrate in Mb/s
        return m_bitrate;
    }
    Access method not required, using protected property
%}

classdef Receiver < handle
    properties (GetAccess='protected', SetAccess='protected')
        m_bitrate; % Bitrate in Mb/s
    end
end

Contact us