class CTest
{
public:
void someMethod()
{
int nCount = 0;
cout << "This is some method --> " << nCount;
}
};
int main()
{
CTest *pctest;
pctest->someMethod();
return 0;
}
It will executes the someMethod() and displays the value
too. how is it possible with our creating memory for the
class . i think iam not creating object for the class.
Thanks in Advance...
Prakash
Answer / Hirawan Lal
In this code, you are defining a class named CTest and its method someMethod. However, to execute the someMethod() and display its output, you need to create an object of the class CTest. This can be done using the 'new' keyword followed by the class name. For example: CTest pctest(new CTest()); pctest.someMethod();
| Is This Answer Correct ? | 0 Yes | 0 No |
what i oops concept, how many languages supports oops concept?
I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
Definition of Object Oriented Programming in single line?
33 Answers Impact Systems, Q3 Technologies, TCS,
how do u initialize the constant variables
what's the basic's in dot net
How does polymorphism work?
Advantage and disadvantage of routing in telecom sector
What do you mean by variable?
Why a "operator=(...)" when there is a copy ctor?
officer say me - i am offered to a smoking , then what can you say
What are virtual classes?