|
Hello, I am writing a "Date" class for an assignment and I am having trouble doing one the of the functions.
This is the header file for the class.
class Date { public: Date(); // Constructor without parameters Date(int m, int d, int y); // Constructor...
Started by jualin on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
In your case the dates, C++ already includes a great facility for object comparison: operator == which allows writing clearer code than calling a Compare....
Month == rhs.month && day == rhs.day ; }
Compare object by contents , i.e.
|
|
Error: Fatal error: Call to a member function bind_param() on a non-object in /var/www/web55/web/pdftest/events.php on line 76
Code: public function countDaysWithoutEvents(){ $sql = "SELECT 7 - COUNT(*) AS NumDaysWithoutEvents FROM (SELECT d.date FROM...
Started by Malfist on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Check your to execute any member function on what you think is an object returned by the prepare function"); // handling here return (7 - $count)....
Mysqli manual :
mysqli_prepare() returns a statement object or FALSE if an error occurred.
|
|
If I call a destructor explicitly ( myObject.~Object() ) does this assure me that the object will be appropriately destroyed (calling all child destructors) ?
Ok some code:
class Object { virtual ~Object() {} }; class Widget : public Object { virtual ...
Started by Robert Gould on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
Running the destructor does not free memory....
Edit : Consider allocating the memory yourself manually rather than using new to allocate the first object and then re-using its memory.
calling the destructor is an acceptable, if unusual, idiom.
|
Ask your Facebook Friends
|
This little bit of syntax has been a bit of a confusion for me in Objective-C.
When should I call self.myObject vs just calling myObject.
It seems redundant however they are not interchangeable.
Would someone please enlighten me?
Started by Jonah on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
If you're using synthesized accesors, then calling them just adds; self.myObject = anotherObject;
The second ....
You should almost never call property accessors from within the implementation of the same class to access that state directly.
|
|
If I have a method such as:
private function testMethod(param:string):void { // Get the object that called this function }
Inside the testMethod, can I work out what object called us? e.g.
class A { doSomething() { var b:B = new B(); b.fooBar(); } } class...
Started by Mark Ingram on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The arguments object is still available in AS3 the caller property was removed from AS3 (and therefore Flex 3 tricky stuff, it should be better for the caller to be able to supply the target object, anyway object, but the caller ....
|
|
I want to create an object in Objective C but I don't hold a reference to it.
Is it allowed to let the object control its own lifetime by calling [self release]?
In case you're wondering why I need this: I want to create an object that subscribes to some...
Started by Philippe Leybaert on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
This is ....
The object no longer needed.
Rather than a simple release since you're still executing code in self when you call it, but other, The best example of its usage is when you create an object that goes off to download a url.
|
|
What I'm wondering is if it's possible to (for instance) to walk up the stack frames, checking each calling object to see if matches an interface, and if so extract some data from it.
Yes, I know it's bad practice, I'm wondering if it's possible.
Answer Snippets (Read the full thread at stackoverflow):
As for getting data from....
You can walk the stack to find the calling method , with the caveat that it's really slow.
That won't tell you what the calling object is though description.
And may be inaccurate due to JIT optimisations.
|
|
Hi, i need to have a handler on the calling object of onclick event
ie
<a href="123.com" onclick="click123(event);">link</a> <script> function click123(event) { //i need <a> so i can manipulate it with Jquery } </script>
...
Started by Konstantinos on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
If you're) { // "this" points to the <a> element // "e" points to the event object }); });.
Bug }
where e is the event object that is passed to the function in browsers other than IE.
|
|
I need to use a COM object in my .NET 2.0 compact framework project, but I can't use the CreateObject function. Is there any other way to call a COM object that will work in my environment?
Started by Rowan on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Make sure.
If you only have a ProgID then you need to call CLSIDFromProgID() first.
You can find a P/Invoke declaration for it here.
You'll need to call CoCreateInstance().
Try this MSDN article.
|
|
In vb I can do that
sub SetFocusControl(byref ctl as object) ctl.Focus end sub
in c# the compiler complaint that object doesn't have a Focus method
void SetFocusControl(ref object ctl) { ctl.Focus(); }
how can I do the same in c#?
thanks
Started by Javier on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Could you not just call the Focus method directly?
ctl.Focus();
If you don't know the type or if it has a Focus method you could do this.
Void SetFocusControl(Control ctl.
Instead of using object, use the type that has the Focus method.
|