Welcome to pickSourcecode.com Login | Register    
pickZy.com
 Home  | search  | games  | General  | C  | C++  | Java  | Php  | Networking  | Visual Basic  | VC++  | Win32  | MFC  | JavaScript  | Jobs  | JavaScript  | Post jobs
Cpp - Access a Class Member Function Without Creating a Class Object       Share
2008-11-03 |  RatheeshTR  | Viewed: 1536  |    2

In some cases, it is possible to call a class member 
function without creating the class object. 
In the following example, the program will 
pr
int "hello world" although class A has never been 
created. When the program enters the "PrintMe" 
function, the "this" pointer is zero. This is fine as 
long as you don't access data members through 
the "this" pointer. 


#include <stdio.h>
class A {

public:

void PrintMe();
};



void A::PrintMe()
{

    printf("Hello World\n");

}


void main()
{


A* p = 0;

p->PrintMe();


}



Comments:





Submit comment's

Type:

User Comment's:

Submitted By:
Prof: Software
Tech: C ,Cpp
Send Mail: malathi.v



Related topics
Stack Implementation
cpp stack example

General Topics
elemets of a defect report
measures of defect report
test metrics
agile methodology
test entry and exit criteria
severity and priority
race condtions and memory leak
performance testing

Web site contents © Copyright 2007, All rights reserved.
Help | Terms and Conditions | Privacy Policy | About Us