爱因斯坦谜题的c语言解答
JCOOP入门指南[02]

JCOOP入门指南[01]

pingf posted @ Thu, 08 Jul 2010 07:39:44 -1100 in C语言 with tags 创作 , 4710 readers

写一点关于JCOOP的入门指南,JCOOP最核心的部分是由一堆宏构成的,

能够简化C语言描述对象的过程,具体代码见sourceforge.net/projects/jcoop

下面是最简单的一个例子,

涉及到用JCOOP构造类的方法之一以及构造函数与析构函数的使用

因为这个例子非常简单,多的就不写了,直接看注释就好

[那个jc_oop.h要到上面的网址下载,另外最好用GCC来编译,MS那套东西我没测试过,Mingw肯定欧科的]

 
#include <stdio.h>                                                                                                     
#include "./include/jc_oop.h"

static void cry(){
	printf("baby is crying...\n");
}


CLASS(Baby)
	int age; //表示年龄的成员
	METHOD(void,cry)(void); //两个void分别对应返回值和参数
END_CLASS

CTOR(Baby) //构造函式
	printf("Baby constructor called ... \n");
	ASSIGN(age,1); //赋值
	CONNECT(cry,cry); //链接到指定的函式
END_CTOR

DTOR(Baby) //析构函式
	printf("Baby destructor called ... \n");
	UNASSIGN(age); //置零
	DISCONNECT(cry); //断开链接
END_DTOR

int main(){
	NEW(Baby,baby,NULL);
	printf("the baby's age is %d\n",baby->age);    
	baby->cry();
	DEL(Baby,baby);
	return 0;
}

运行时会打印如下的字符串

Baby constructor called ... 
the baby's age is 1
baby is crying...
Baby destructor called ... 

需要注意的是上面的Baby类是构造在堆上的,所以baby自然是一个指针

其在NEW时分配相应的内存,并初始化相应的值(构造函数),

在DEL时调用析构函数释放对应的内存.

从上面的代码不难发现,使用JCOOP不但可以形象的描述一个类,

而且简化了代码的编写,特别是涉及内存分配相关的部分.

 

 

 

AAA said:
Sat, 14 May 2022 06:10:23 -1100

Good site! I really love how it is easy on my eyes and the data are well written. I am wondering how I might be notified whenever a new post has been made. I’ve subscribed to your RSS feed which must do the trick! Have a great day! Selling Payment Processing Services

 

======================================

 

Nice post , this is my first time i read this blog and i found it very interesting , nice job . North American Bancard Agent Program

AAA said:
Mon, 16 May 2022 09:44:02 -1100

Cheers for this particular tips I has been researching all Search engines to be able to come across it! 生物精靈

meidir said:
Thu, 21 Jul 2022 01:53:24 -1100

Your blog has the same post as another author but i like your better. LED補光燈

meidir said:
Wed, 24 Aug 2022 00:26:57 -1100

Appreciate it for all your efforts that you have put in this. very interesting info . skin

meidir said:
Wed, 24 Aug 2022 04:34:40 -1100

We've sell some products of different custom boxes.it is very useful and suprisingly low price please visits this site thanks and please share this post together with your friends. 안마야

MPBSE Board 11th Pre said:
Wed, 24 Aug 2022 17:44:37 -1100

MP Board 11th Class Important Model Question Paper 2023 PDF will be Announced on the Official Website. Madhya Pradesh Class 11th Arts, Science, Commerce Group Important Model Question Paper 2023 Format of Last Year Important Model Question Paper 2023 and Other Attachments are Provided Under. MPBSE Board 11th Previous Paper 2023 MP Board 11th Class Biology, Physics, Economics, Fine Arts, Hindi, English, Second Language, Psychology, Sociology, Political Science and Other Subjects Important Model Question Paper 2023 will be Proclaimed in the Online Mode. Madhya Pradesh Class 11th Standard Pursuing Students can Download the Important Model Question Paper 2023 for the Additional References. on This Page, We Have Given More Details About the MP Board 11th Class Important Model Question Paper 2023, and Exam Format.

meidir said:
Fri, 10 Feb 2023 05:33:06 -1100

I’d have to talk to you here. Which is not some thing It’s my job to do! I love reading a post that should make people feel. Also, many thanks allowing me to comment! SaaS Lawyer

 

 

=========================

 

 

What youre saying is completely true. It’s certainly an opinion I agree with. SaaS Attorney

meidir said:
Mon, 13 Feb 2023 21:59:13 -1100

Your blog has the same post as another author but i like your better. SaaS Lawyer

meidir said:
Thu, 16 Feb 2023 23:07:35 -1100

this song make sme cry, because my ex boyfriend sent me this when we were fighting….i would have done suicide that night i listened to this apuestasdeportivas

 

 

==============================

 

 

 

I have been exploring for a bit for any high quality articles or blog posts on this kind of house . Exploring in Yahoo I ultimately stumbled upon this site. Studying this info So i’m happy to express that I have an incredibly just right uncanny feeling I came upon exactly what I needed. I so much no doubt will make certain to don’t disregard this site and provides it a glance a continuing. hacking etico

meidir said:
Sun, 19 Feb 2023 23:00:05 -1100

You really should experience a tournament first of the finest blogs on the internet. I’m going to suggest this website! career counselling for creatives

meidir said:
Tue, 21 Feb 2023 02:44:09 -1100

I have been checking out many of your stories and it’s pretty nice stuff. I will make sure to bookmark your site florisis online

meidir said:
Sat, 25 Feb 2023 04:10:35 -1100

I discovered your blog web site on google and appearance a couple of your early posts. Always keep in the very good operate. I recently extra up your Feed to my MSN News Reader. Looking for toward reading a lot more by you at a later date!… como medir metricas seo gratis

 

 

=======================

 

 

Wonderful paintings! This is the kind of info that are meant to be shared across the net. Disgrace on search engines for no longer positioning this publish upper! Come on over and talk over with my website . Thank you =) métricas básicas de la analítica web

 

 

=======================

 

 

Thank you for the great content. I am glad I have taken the time to see this. metamizol para que sirve

meidir said:
Mon, 27 Feb 2023 21:00:48 -1100

But wanna remark on few general things, The website design and style is perfect, the subject matter is very superb : D. Buy IMAT Certificate (International Medical Admissions Test) without exam

 

 

==========================

 

 

I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will find that very useful. Buy NCLEX Certificate online

 

 

============================

 

 

I am glad to be a visitant of this staring web blog, regards for this rare information! Buy Kush Liquid Incense on Paper

meidir said:
Tue, 28 Feb 2023 06:20:04 -1100

When I originally commented I clicked the -Notify me when new surveys are added- checkbox now if a comment is added I receive four emails sticking with the same comment. Will there be however it is possible to eliminate me from that service? Thanks! Grading engineer

meidir said:
Wed, 01 Mar 2023 21:10:35 -1100

There are a handful of fascinating points with time in this post but I do not determine if them all center to heart. There’s some validity but I am going to take hold opinion until I check into it further. Very good article , thanks and now we want a lot more! Added onto FeedBurner also Buy cheap upright headstones

meidir said:
Wed, 15 Mar 2023 03:35:47 -1100

I’m usually to blogging and that i really appreciate your articles. The actual article has really highs my personal curiosity. I am going to bookmark your own site and maintain checking for brand spanking new info. slot auto wallet

 

 

======================

 

 

Aw, it was a very good post. In idea I must invest writing such as this additionally – spending time and actual effort to produce a excellent article… but what can I say… I procrastinate alot by no means often get something carried out. jilislot ทางเข้า

 

 

======================

 

 

You need to be a part of a tournament for one of the highest quality blogs online. I am going to recommend this page! สล็อตออนไลน์

 

 

======================

 

 

You made some respectable factors there. I seemed on the web for the difficulty and located most individuals will go together with along with your website. sa game

 

 

======================

 

 

I love reading through a post that may make people feel. Additionally, thank you for enabling me personally to comment! ทางเข้า easy slot online

 

 

======================

 

 

This is a really good read for me. Must agree that you are one of the coolest blogger I ever saw. Thanks for posting this useful information. This was just what I was on looking for. I’ll come back to this blog for sure! easyslot

 

 

======================

 

 

Can I simply say what a relief to seek out somebody who really is aware of what theyre speaking about on the internet. You undoubtedly know the best way to bring a problem to mild and make it important. Extra people need to learn this and perceive this aspect of the story. I cant believe youre not more widespread since you positively have the gift. slot online

 

 

================================

 

 

I was very happy to find this internet site on bing, just what I was looking for : D too saved to favorites . คลินิคทันตกรรม

meidir said:
Wed, 15 Mar 2023 06:48:02 -1100

I love the dear data you be offering to your articles. I can bookmark your weblog and feature my youngsters test up here generally. I’m slightly sure they’ll be told a whole lot of new stuff here than any one else! Pub Digital marketing agency

meidir said:
Sat, 18 Mar 2023 08:08:50 -1100

fashion jewelries will be one of the best stuffs that you can use to enhance your personal style` Descargar Software Gratis

 

 

====================

 

 

Thanks for the great post on your blog, it really gives me an insight on this topic.:*;:~ https://weloveanimalsclub.blogspot.com/

meidir said:
Sat, 25 Mar 2023 03:50:59 -1100

You can’t just tell someone to be friends with someone else, that has to happen naturally. contrario de empatia

meidir said:
Mon, 27 Mar 2023 04:04:37 -1100

if you are not eating much fiber, then you will always get indigestion. so eat lots of dietary fibers“ Woking taxi service

meidir said:
Mon, 03 Apr 2023 06:06:07 -1100

Do you know this site is suggested by a number of other sites? Great work. Thank you very much! Frenches for sale in Michigan

meidir said:
Sat, 08 Apr 2023 00:00:48 -1100

i use Garmin GPS whenever i go out, Garmin GPS is very reliable. Woking taxi to Heathrow

meidir said:
Mon, 10 Apr 2023 01:37:12 -1100

It is in point of fact a great and helpful piece of information. I’m glad that you simply shared this useful information with us. Please stay us up to date like this. Thanks for sharing. cuantos lúmenes necesita una planta de cannabis

 

=================

 

Hello dude,i like this Ones blog very much. do u have suggestion for my homepage? thanks as bolsas de manta

 

=================

 

Someone essentially assist to make significantly articles I’d state. That is the first time I frequented your website page and to this point? I’m amazed with the research you made to create this actual put up amazing. Wonderful job! paginas web panama

meidir said:
Tue, 11 Apr 2023 01:07:48 -1100

I have been examinating out many of your stories and it’s pretty good stuff. I will definitely bookmark your website. fun88

 

==================

 

In this awesome scheme of things you actually get an A+ just for hard work. Exactly where you lost everybody ended up being in your particulars. You know, people say, details make or break the argument.. And that could not be much more true here. Having said that, permit me say to you what exactly did give good results. The article (parts of it) is actually incredibly powerful which is most likely the reason why I am making the effort in order to comment. I do not really make it a regular habit of doing that. Secondly, although I can certainly see the jumps in reason you come up with, I am not really sure of exactly how you seem to connect your ideas which inturn make the actual conclusion. For the moment I will yield to your point however wish in the foreseeable future you connect your dots much better. w88

meidir said:
Sat, 15 Apr 2023 22:42:50 -1100

“You really know your stuff… Keep up the good work!” agencia marketing digital bogota

 

 

===========================

 

 

 

I love to visit your web-blog, the themes are nice.?C??.; all inclusive rio de janeiro

meidir said:
Mon, 17 Apr 2023 03:46:08 -1100

I understand where your coming from, and I simply love the article. For what its worth I also love the design of your website, extremely imaginative. Thank you. PAW Patrol

meidir said:
Thu, 04 May 2023 04:12:14 -1100

i wish to have some diamond necklace but they are quite expensive’ investment real estate

meidir said:
Sat, 13 May 2023 20:57:27 -1100

I truly enjoy examining on this website , it has good content . tienda ecológica online

meidir said:
Fri, 19 May 2023 18:47:33 -1100

This was an incredible post. Really loved studying your site post. Your data was very informative and helpful. I think you’ll proceed posting and updating frequently. Looking forward to your subsequent one. BUY TELC CERTIFICATE WITHOUT EXAM

 

 

 

============================

 

 

 

Thanks for this post. I definitely agree with what you are saying. I have been talking about this subject a lot lately with my brother so hopefully this will get him to see my point of view. Strafverteidiger Hagen

meidir said:
Sat, 20 May 2023 06:01:22 -1100

I used to be recommended this website by my cousin. I am no longer sure whether this put up is written by way of him as no one else realize such precise approximately my trouble. You are wonderful! Thank you! Hoteles con Piscina en Toledo

meidir said:
Sun, 21 May 2023 06:16:29 -1100

Spot on with this write-up, I really assume this website needs much more consideration. I’ll probably be once more to read far more, thanks for that info. extranjeria zaragoza telefono


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter