EnglishFrenchGermanSpainItalianDutchPortugueseRussianKoreanJapaneseArabic Chinese Simplified

Wednesday, June 29, 2011

Class Inheritance

Using the foo class from the previous tutorial as a base class, we are going to introduce a new class called fooed that inherits from foo. Here are the two classes without any methods.


class foo {
    public:
        int    m_counter;
        float  m_value;
        char * m_buffer;
};

class fooed : public foo {
    public:
        double m_double;
}; 
As in the previous tutorial, both the class fooed and the structure fooed have exactly the same size of twenty bytes (a double field being eight bytes in length).

 

Artikel Terkait:

Comments :

0 comments to “Class Inheritance”

Post a Comment

 

Copyright © 2009 by Learn Technology

Template by Blogger Templates | Powered by Blogger