|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Comparison of two classes My problem is quite hard to explain but I'll try to ask my question clearly: I have a class with an attribute PluginWidget type QWidget * I try to reimplement the == operator so that we can compare a QWidget * A PluginWidget (_widget is the attribute of PluginWidget) : PluginWidget bool:: operator == (nWidget QWidget *) (return _widget == nWidget) I then one of PluginWidget @ list, but when I do an @ list:: indexOf (const T & value, int from = 0), I get error... Is that necessary to declare object in class from which they derived. |
#2
| |||
| |||
Re: Comparison of two classes The error because the same type for the argument of indexOf that used for the list. On top of that, you have a list filled with PluginWidget you want to compare with QWidget *, you compare pointers and objects. Code: int * a = new int; * a = 5; b = 5; if (a == b) () |
#3
| |||
| |||
Re: Comparison of two classes Difference Between Class & Objects : A class is a definition of an object. It's a type just like int. if once the class is created it remains till the end of the program, we can't made another class with the same name of the previous class. |
#4
| |||
| |||
Re: Comparison of two classes Class is a userdefined datatype with data members and member functions which can be public or privately accessed depending on access specifiers.Class is static. The attributes of a class always remain unchanged. Class and object both are related to each other, without class, object is of no use and without object, class is useless. Example : Code: struct D { int b; double C; }; struct E { int b; double c; C c; }; // initialize an object of type C with an initializer-list C c = { 1, 2 }; // D has a sub-aggregate of type C. In such cases initializer-clauses can be nested D d = { 10, 20, { 1, 2 } }; |
![]() |
|
Tags: attribute, class, object |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with Inner classes | Captain Carrot | Software Development | 5 | 11-03-2010 02:14 PM |
Use of abstract classes | ScarFace 01 | Software Development | 5 | 25-01-2010 09:07 AM |
Sealed Classes in C# | Reegan | Software Development | 5 | 27-11-2009 09:16 AM |
C # using classes in C + + | klite | Software Development | 3 | 01-10-2009 10:15 AM |
Classes in VB.NET | Samir_1 | Software Development | 2 | 10-04-2009 12:07 AM |