CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Computer Programming (http://www.codingforums.com/forumdisplay.php?f=21)
-   -   C++ lists (http://www.codingforums.com/showthread.php?t=286295)

007julien 01-23-2013 02:34 PM

C++ lists
 
Hello,
I try to work with C++...
How to retrieve the m_Digits list of int, with this hh (and particularly the GetDigits function) for a class of big Integers ?
Code:

class Integer
{
        short m_Sign; // m_Sign<0 <=> this<0
        list<int> m_Digits;

public:
        Integer();
        Integer(int n);
        Integer(const char*);
        Integer(const Integer& n);

        short GetSign() const {return m_Sign;};
        const list<int>& GetDigits() const {return m_Digits;};
        The function to use to retrieve the digits
        const list<int>& GetDigits() const {return m_Digits;};
        //...
};
Integer abs(const Integer& a);
Integer fact(Integer a);
Integer pgcd(Integer a, Integer b);
Integer ppcm(Integer a, Integer b);
Integer pow(Integer a, int b);
Integer pow(Integer a, Integer b);
// The new function to build
Integer sqrt(Integer a);

I do not clearly understand the definition of the line
Code:

const list<int>& GetDigits() const {return m_Digits;};
and I am unable to declare a list<int> variable to retrieve this list.

Thanks !


All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.