|
Actually Mr.Humid its one application on GUI part.In this GUI part was terminated at runtime..but its not appeare any error ..thats y i am very confuse
Please tell me how to solve this problem
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
Did you recompile your project on the Vista I had like your error previous ?
|
|
|
|
|
Hello everyone,
Which C++ rule do I break in the following code? Why there is compile error?
class Foo{
public:
Foo()
{
}
int foo1()
{
return 100;
}
const Foo getCurrent1()
{
return *this;
}
const Foo& getCurrent2()
{
return *this;
}
};
int main()
{
Foo f;
f.getCurrent1().foo1();
f.getCurrent2().foo1();
return 0;
}
thanks in advance,
George
|
|
|
|
|
int foo1() is not a const function so you can't call it on a const object or through a const reference. This will fix it:
int foo1() const
Steve
|
|
|
|
|
Thanks Steve, my question is answered.
regards,
George
|
|
|
|
|
http://www.codeproject.com/useritems/GINA_SPY.asp
|
|
|
|
|
Did you search on the codeproject?
|
|
|
|
|
Hello everyone,
I am learning Liskov substitution principle,
http://en.wikipedia.org/wiki/Liskov_substitution_principle
But the description is not common senses. Now I understand this principle to be, if we have some methods in base class, then we also need to implement the methods in derived class. My understanding correct? Anything else missing?
thanks in advance,
George
|
|
|
|
|
"In object-oriented programming, the Liskov substitution principle is a particular definition of subtype, which is based on the notion of substitutability; that is, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program".
"Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T."
for example;
template <typename T>
class propertyQ
{
public:
static void QMethod1(T &objT)
{
objT.operate1();
}
static void QMethod2(T &objT)
{
objT.operate2();
}
};
class superTypeA
{
protected:
int m_iContext;
public:
superTypeA()
: m_iContext(0)
{
}
void operate1()
{
m_iContext = 1;
}
void operate2()
{
m_iContext = 2;
}
};
class subTypeA : public superTypeA
{
public:
void operate2()
{
m_iContext = 21;
}
};
class subTypeB : private superTypeA
{
public:
void operate2()
{
m_iContext = 21;
}
};
int main()
{
subTypeA objA;
subTypeB objB;
propertyQ <subTypeA>::QMethod1(objA);
propertyQ <subTypeB>::QMethod1(objB);
return 0;
}
class propertyQ is written based on the supertype class superTypeA. Here subtype, class SubTypeA, is subtitutable for supertype class, superTypeA, for the property, class propertyQ, without altering the program and is said to follow Liskov substitution principle; while subtype, class SubTypeB, uses private inheritance and cannot be substitutable for supertype, class superTypeA and is said to violate Liskov substitution principle.
George_George wrote: Now I understand this principle to be, if we have some methods in base class, then we also need to implement the methods in derived class. My understanding correct?
No, look at the above example, subtype, class subTypeA, overrides only method, void operate2(), while the method, void operate1() is inherited from superclass, class superTypeA.
here i think u misuderstood between, nominal subtype and structural subtype; in OOP, nominal subype is induced by inheritance while structural subtype is that eventhough u didnot inherit from base class, class superTypeA, if u r implementing all the functions in every class you are able to apply the property, class propertyQ.
George_George wrote: But the description is not common senses.
does my explaination makes sense.
|
|
|
|
|
Thanks Rajkumar!
Your reply is great!!
Most of my confusions are solved. Just one point about structural subtype, you mentioned below,
Rajkumar R wrote: structural subtype is that eventhough u didnot inherit from base class, class superTypeA, if u r implementing all the functions in every class you are able to apply the property, class propertyQ.
What means "if u r implementing all the functions in every class" and "you are able to apply the property, class propertyQ"? What do you mean all the functions and every class?
regards,
George
|
|
|
|
|
George_George wrote: What means "if u r implementing all the functions in every class" and "you are able to apply the property, class propertyQ"? What do you mean all the functions and every class?
struct subTypeA
{
subTypeA()
: m_iContext(0)
{
}
void operate1()
{
m_iContext = 1;
}
void operate2()
{
m_iContext = 2;
}
private:
int m_iContext;
};
struct subTypeB
{
subTypeB()
: m_iContext(0)
{
}
void operate1()
{
m_iContext = 1;
}
void operate2()
{
m_iContext = 2;
}
private:
int m_iContext;
};
it is obvious.
now the propery q(subTypeA) and q(subTypeB) both works
propertyQ <subTypeA>::QMethod1(objA);
propertyQ <subTypeB>::QMethod1(objB);
|
|
|
|
|
Thanks Rajkumar,
My stupid before.
regards,
George
|
|
|
|
|
George_George wrote: My stupid before.
I actually used the sample propertyQ() as a template class to address both the nominal and structural subtype.
otherwise i can only address nominal type if i used the following example;
void propertyQ(superTypeA *obj)
{
obj->operate1();
}
then
subTypeA objA;
subTypeB objB;
propertyQ(&objA);
propertyQ(&objB);
*__w64 ' to 'superTypeA *' exists, but is inaccessible
In this case i cannot address structural subtype.
|
|
|
|
|
Thanks Rajkumar,
My question is answered.
regards,
George
|
|
|
|
|
dear all
i would like to generate such code: i have to Gaussian size mask according to different sigma value,anyone has such code? please help me, thanks a lot.or anyone know how to determine Gaussian mask size according to different sigma value.
Li Zhiyuan
|
|
|
|
|
Looks like someone already answered this question to someone who has been here long enough to know not to title messagees with 'help.'
|
|
|
|
|
thanks, friend, yes, they answered, but not exactly, so i still didn't solve it. thanks a lot.
Li Zhiyuan
|
|
|
|
|
And friend, i remember u got comments, theory, pseudo code, code in C#, i think you are expected C++ code only. if so, why can't you port to C++ as needed.
|
|
|
|
|
thanks for your reminder, i didn't find, can you send me again. thanks a lot.
Li Zhiyuan
|
|
|
|
|
Go to your own profile, and click the "Messages posted" link.
Maxwell Chen
|
|
|
|
|
li zhiyuan wrote: thanks for your reminder, i didn't find, can you send me again.
code in C#: [^]
pseudo code: [^]
comments: [^]
theory: [^]
see maxwell's comment also.
gentle query: why these are not useful?
|
|
|
|
|
Is there any way of establishing whilst running an installation program, whether the session running it has administrator authority.
Bram van Kampen
|
|
|
|
|
IsUserAnAdmin()[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
Shontay wrote: this program is surposed to do the same but by using another parameter
not clear, can you pleace be more specific.
|
|
|
|