answersLogoWhite

0


Best Answer

You cannot point at a class, you can only point at an instance of a class, which is simply another term for an object. The class is essentially the object's type; it define's the object's behaviour, but is not the object in and of itself. The class also defines a pointer's type, so we can point at instances of a class and access the the object it represents through indirection.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

A function is a procedure that (optionally) acts upon given data and (optionally) returns a value or a reference to a value. However, the function and the given data are completely separate entities.

A class is a type that (generally) encapsulates data and the procedures that act upon that data into a single entity known as an object. An object is an instance of a class (the class defines the object's type).

Member methods are the functions of a class while member variables are the data of a class. There is no need to pass member variables to a member method, since the class itself encapsulates all its members and can therefore access them directly. That is, the data and functions are not separated -- they are both part of the same entity. However, external (separate) data can still be passed to member methods when required, to initialise or set a member variable for instance.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

A class is the definition for a type of object that can instantiated. An object is an instance of that class. You work with the objects, not the class. The class merely describes what you can do with the object.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

The same as in any object-oriented language. A class - which is where the actual programming is done - is a template to create objects. Objects are created on the basis of the classes. If you consider classes as new data types, the class is the definition of a new data type, while the objects are individual variables of this new data type.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

C is not an object oriented programming language. You probably meant C++. A class is a type. An object is an instance of a class.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

A class is the definition of a type, while an object is an instance of a class.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

There is no difference; to define an object in C++ you use the 'class' definition

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

A class is a type definition. An object is an instance of a class.

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

A class is a user-defined data type while an object is an instance of a class. We use classes to define an object's behaviour.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between a class and a function in C plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between friend function and inheritance in c plus plus?

There is no such thing. When declaring a friend function only the explicitly-scoped friend is granted private access. The friend function may well be declared virtual within its own class but none of its overrides are granted access unless they are explicitly granted access.


What is the difference between an attribute and a behavior in c plus plus?

An attribute is a class member variable while a behaviour is a class member method.


What is member fusion in c plus plus?

If you are asking about member functions. When we declare a function inside a class then that function becomes member function of that class and this function can access the whole class


What is the difference between public and private in c plus plus?

A private member can only be accessed by other methods of the same class, while a public member can be accessed by methods of any class or by non class code.


What is the difference between constructor and friend function in c plus plus?

A constructor is a method that fires when the object is instantiated. A friend function is a function that has special access to the object. They are two different types of things, and cannot be further differenced.


What is the unit of programming in c plus plus A. Function B. class C. object D. Attribute?

B. Class.


What is the use of private constructor in c plus plus?

Private construction prevents objects from the class from being instantiated other than via a static member function of the class, a friend function or a friend class.


What is the difference between C plus plus and the original language?

C++ is easier to use as you have to learn slightly less and script slightly to make your function(s) work.


Why can't the accessor member function change any of the values in a class in C plus plus?

Nothing stops a member function from changing any of the values in a class. By convention, an accessor function is used to give read only access to class data, but that does not mean that it is prohibited from doing so. It is a member function, after all, and it has all the rights of any member function of the class.


What is self referential function in c plus plus?

A self-referential function in C++, or in any other supporting language, is a recursive function.


What is the difference between class data type and basic type in c plus plus .How can someone know which one is class type and which one is basic type.?

Basic types (primitive data types) have no methods associated with them.


Which C plus plus keyword allows a function outside of a class to access private class members?

The keyword is friend. The external function must be declared a friend of the class (from within the class itself) in order to become a member of the class and thus gain access to the private (and protected) members of the class.