Sponsored Content
Full Discussion: Printing class address!
Top Forums Programming Printing class address! Post 302500831 by Corona688 on Tuesday 1st of March 2011 04:20:52 PM
Old 03-01-2011
Code:
#include <stdio.h>

printf("%p", &object);

should work. If you insist on a C++ solution, you could do:
Code:
#include <stddef.h>

...

cout << (ptrdiff_t)&obj;

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

can unix printing directly to ip address

Thanks in advance. I am researching if it is possible for unix (solaris) to print directly printers with IP addresses. Without adding all the ip addresses to the hosts file? There are more than a hundred printers and managing them in a hosts file would be tedius, prone to error, and time... (4 Replies)
Discussion started by: maguired
4 Replies

2. UNIX for Dummies Questions & Answers

car class (not school class)

im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies

3. Programming

C++ class definition with a member of the same class

Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento) typedef struct elemento { char name; char value; List<struct elemento> ltElementos; ... (7 Replies)
Discussion started by: pogdorica
7 Replies

4. UNIX for Dummies Questions & Answers

Printing pointer address

How can I print the memory address of a pointer using printf (or any other STDOUT functions?). I see in Linux its %p but not in unix, help? thanks (5 Replies)
Discussion started by: perleo
5 Replies

5. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies

6. Programming

Size of Derived class, upon virtual base class inheritance

I have the two class definition as follows. class A { public: int a; }; class B : virtual public A{ }; The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies

7. Shell Programming and Scripting

Finding if my IP address belongs in a Class C group

I need help with a tcl code. I have a variable "myIP" which reads IP address from socket. How do I use regex to find out if it belongs to a group for e.g., 50.65.75.240/28 or 50.65.75.128/25 etc. (2 Replies)
Discussion started by: ampak
2 Replies

8. Programming

Printing values from a class

I have a class and want to print values in MOD using L = new Layer* ; How can I print the values in MOD using this object L??? class Layer { public : Model* MODP; Model* MODS; (1 Reply)
Discussion started by: kristinu
1 Replies

9. Programming

C++ : Base class member function not accessible from derived class

Hello All, I am a learner in C++. I was testing my inheritance knowledge with following piece of code. #include <iostream> using namespace std; class base { public : void display() { cout << "In base display()" << endl; } void display(int k) {... (2 Replies)
Discussion started by: anand.shah
2 Replies
IS_A(3) 								 1								   IS_A(3)

is_a - Checks if the object is of this class or has this class as one of its parents

SYNOPSIS
bool is_a FALSE (object $object, string $class_name, [bool $allow_string]) DESCRIPTION
Checks if the given $object is of this class or has this class as one of its parents. PARAMETERS
o $object - The tested object o $class_name - The class name o $allow_string - If this parameter set to FALSE, string class name as $object is not allowed. This also prevents from calling autoloader if the class doesn't exist. RETURN VALUES
Returns TRUE if the object is of this class or has this class as one of its parents, FALSE otherwise. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.9 | | | | | | | Added $allow_string parameter | | | | | 5.3.0 | | | | | | | This function is no longer deprecated, and will | | | therefore no longer throw E_STRICT warnings. | | | | | 5.0.0 | | | | | | | This function became deprecated in favour of the | | | instanceof operator. Calling this function will | | | result in an E_STRICT warning. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 is_a(3) example <?php // define a class class WidgetFactory { var $oink = 'moo'; } // create a new object $WF = new WidgetFactory(); if (is_a($WF, 'WidgetFactory')) { echo "yes, $WF is still a WidgetFactory "; } ?> Example #2 Using the instanceof operator in PHP 5 <?php if ($WF instanceof WidgetFactory) { echo 'Yes, $WF is a WidgetFactory'; } ?> SEE ALSO
get_class(3), get_parent_class(3), is_subclass_of(3). PHP Documentation Group IS_A(3)
All times are GMT -4. The time now is 03:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy