Click here to Skip to main content
15,901,782 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralNew user interface issues for my application Pin
tim63516-Mar-05 21:13
tim63516-Mar-05 21:13 
GeneralRe: New user interface issues for my application Pin
John R. Shaw17-Mar-05 6:27
John R. Shaw17-Mar-05 6:27 
GeneralTCP/IP guru - please help Pin
eli1502197916-Mar-05 21:02
eli1502197916-Mar-05 21:02 
Questionremove system menu icon from dialog? Pin
ThinkingPrometheus16-Mar-05 20:57
ThinkingPrometheus16-Mar-05 20:57 
AnswerRe: remove system menu icon from dialog? Pin
toxcct16-Mar-05 22:25
toxcct16-Mar-05 22:25 
GeneralImage Capture from Device Pin
Anand for every one16-Mar-05 20:47
Anand for every one16-Mar-05 20:47 
GeneralFriend Functions Pin
phijophlip16-Mar-05 20:29
phijophlip16-Mar-05 20:29 
GeneralRe: Friend Functions Pin
toxcct16-Mar-05 21:03
toxcct16-Mar-05 21:03 
hi,

i'm not sure to understand your whole question, but here is what i can say :

first, i cannot see any relevant change btween your two programs, except the fact tha the former has another ABC object. in this case, xyz and xyz1 are two distinct objects, but constructed the same way (that's why the outputs are the same).

i've got a question about your code...
why putting showme() functions as friend
when you have no data members (moreover no protected members) ? this could have been done with external functions because show() and show2() are public.


phijophlip wrote:
My question is out of two c++ program , the optimized code is which one. If not the case the two programs how can I write optimised code for the c++ program which is described above.

i don't understand this question, please reformulate... (what optimization do you want ? mem, speed ?)


phijophlip wrote:
object are allocated space in the memory.when define a class and it members and member functions.Does class have its own memory space as it is with object of class?

that's not exactly like this. data members are allocated in the stack while dynamically allocated datas are in the heap. this way, each object has its own datas, even if they contain the same values as another object.
BUT ! every objects of the same type share the functions of the class. that means that the functions code is written once in the code segment. to determinate which object is calling a function, the functiopn receive an implicite parameter (this) that points the object. the static member functions have no this pointer, so, they can manipulate only static data members (shared with every objects of a same type).

i know what i explain is a bit deep, but look for these infos if you like to code better...

cheers,



TOXCCT >>> GEII power
[toxcct][VisualCalc]
GeneralAccess Violation Pin
Usman Arif16-Mar-05 20:26
Usman Arif16-Mar-05 20:26 
GeneralRe: Access Violation Pin
Cedric Moonen16-Mar-05 21:38
Cedric Moonen16-Mar-05 21:38 
GeneralRotate picture Pin
JAMANAKA16-Mar-05 20:09
JAMANAKA16-Mar-05 20:09 
GeneralRe: Rotate picture Pin
John R. Shaw17-Mar-05 6:52
John R. Shaw17-Mar-05 6:52 
GeneralApplictions Communication problem Pin
ReBeL34716-Mar-05 19:47
ReBeL34716-Mar-05 19:47 
GeneralRe: Applictions Communication problem Pin
John R. Shaw17-Mar-05 6:58
John R. Shaw17-Mar-05 6:58 
GeneralGetCurrentHwProfile( ) api usage Pin
brilliant10116-Mar-05 19:21
brilliant10116-Mar-05 19:21 
GeneralProblem with Multiple Instances of ActiveX Control, Please Help Pin
rdeekonda16-Mar-05 18:27
rdeekonda16-Mar-05 18:27 
GeneralHelp on Compiled HTML(CHM) Viewer Pin
anukrati16-Mar-05 18:13
anukrati16-Mar-05 18:13 
GeneralFrame comparison Pin
Francis Chau16-Mar-05 17:12
Francis Chau16-Mar-05 17:12 
Generalvirutal class and friend class Pin
phijophlip16-Mar-05 17:10
phijophlip16-Mar-05 17:10 
GeneralRe: virutal class and friend class Pin
HalfWayMan16-Mar-05 22:32
HalfWayMan16-Mar-05 22:32 
Generaldifference between virutal class and friend class Pin
phijophlip16-Mar-05 17:10
phijophlip16-Mar-05 17:10 
GeneralRe: difference between virutal class and friend class Pin
ThatsAlok16-Mar-05 18:08
ThatsAlok16-Mar-05 18:08 
GeneralRe: difference between virutal class and friend class Pin
toxcct16-Mar-05 21:31
toxcct16-Mar-05 21:31 
GeneralCreating a graph chart Pin
Anonymous16-Mar-05 16:48
Anonymous16-Mar-05 16:48 
GeneralCompilation errors in Debug mode Pin
Gagnon Claude16-Mar-05 16:35
Gagnon Claude16-Mar-05 16:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.