功能或方法? [英] Functions or methods?

查看:80
本文介绍了功能或方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我正在用C编写抽象数据类型,那么是为对这些数据类型执行操作而编写的函数,这些函数是否在接口(.h文件)中公开,称为 functions methods ,还是完全不同的东西?我似乎在任何地方都找不到建设性的答案. method 是C ++专用术语吗?

If I'm writing abstract data types in C, are the functions written to perform actions on these data types and exposed in the interface (.h files) called functions, methods, or something yet completely different? I can't seem to find a constructive answer anywhere. Is method a C++ specific term?

推荐答案

方法是C ++专用术语吗?

Is method a C++ specific term?

方法"是面向对象的编程术语,是指作为对象名称空间一部分的函数.因此,您可以使用C ++,Java,Objective-C等语言为对象创建方法.另一方面,在C中,您仍然拥有独立的函数,而不是方法.

A "method" is an object-oriented programming term, and refers to a function that is part of the namespace of an object. So you can create methods for objects in languages like C++, Java, Objective-C, etc. In C on the otherhand, you still have stand-alone functions, not methods.

请记住,类方法的官方" C ++术语是成员函数",在规范的9.3节中进行了描述.

Keep in mind that the "official" C++ term for a class method is a "member function", and is described in section 9.3 of the spec.

这篇关于功能或方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆