Subclassing
-
subclassing
is not a MFC nor SDK concept but a C++ (and even general OO) concept. it means using a base class to reuse its behavior/design/methods and not reinventing the wheel... another good term for this is alsoinheritence
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
can u please give me a example????
-
can u please give me a example????
class BaseClass {
int m_iSize;public:
int getSize() { return m_iSize; }
void setSize(int i) { m_iSize = i; }
};class ChildClass : public BaseClass {
double m_dPrice;public:
double getPrice() { return m_dPrice; }
void getPrice(double d) { m_dPrice = d; }
};then, you use it like any object which contains all...
ChildClass cc;
cc.setSize(4);
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ] -- modified at 5:30 Friday 12th May, 2006
-
class BaseClass {
int m_iSize;public:
int getSize() { return m_iSize; }
void setSize(int i) { m_iSize = i; }
};class ChildClass : public BaseClass {
double m_dPrice;public:
double getPrice() { return m_dPrice; }
void getPrice(double d) { m_dPrice = d; }
};then, you use it like any object which contains all...
ChildClass cc;
cc.setSize(4);
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ] -- modified at 5:30 Friday 12th May, 2006
toxcct wrote:
class ChildClass : BaseClass {
class ChildClass : **public** BaseClass {
class ChildClass : **protected** BaseClass {
class ChildClass : **private** BaseClass {
Maxwell Chen
-
toxcct wrote:
class ChildClass : BaseClass {
class ChildClass : **public** BaseClass {
class ChildClass : **protected** BaseClass {
class ChildClass : **private** BaseClass {
Maxwell Chen
-
-
NiLeSh KoRpE wrote:
but inheretance also seems to do the same thing
:~ did you read my 1st post ? "another good term for this is also inheritence" yes, it is exactly the same... 2 different word for the same thing. :zzz:
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
what is subclassing actually?? how do u create a subclass in SDK and MFC? Thanks in advance Regards, Prashanth.v
-
are you typing with your phone ? :~
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
are you typing with your phone ? :~
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
are you typing with your phone ? :~
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
yes. n what abt u?
-
-
toxcct wrote:
class ChildClass : BaseClass {
class ChildClass : **public** BaseClass {
class ChildClass : **protected** BaseClass {
class ChildClass : **private** BaseClass {
Maxwell Chen
-
what is subclassing actually?? how do u create a subclass in SDK and MFC? Thanks in advance Regards, Prashanth.v
-
i'm working for zilog,bangalore. n u?
-
i'm working for zilog,bangalore. n u?
-
What a discussion thread and out of context topics !!! .
-
What a discussion thread and out of context topics !!! .
-
sorry all.
-
subclassing
is not a MFC nor SDK concept but a C++ (and even general OO) concept. it means using a base class to reuse its behavior/design/methods and not reinventing the wheel... another good term for this is alsoinheritence
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
Is always tought that subclassing was to change the behaviour of a class in a framework without changing the framework. I guess i'm wrong but what is then the correct term for this kind of pattern. Let me explain by a simple example. You create your own windowproc which is then used to overwrite the normal winproc. By using your own windowproc you can change the behaviour of the subclassed window. codito ergo sum