answersLogoWhite

0


Best Answer

An object is an instance of a class. A class is a data type that combines data and the specific methods that operate upon that data into a self-contained entity.

To prove that objects are user-defined types, consider the following:

class foo

{

};

int main()

{

foo a;

foo b;

foo c = a + b; // ERROR!

}

The reason there is an error is because the plus operator (+) only works with primitive data types (integral, arithmetic and built-in data types). foo is neither an integral, arithmetic nor built-in data type, thus the plus operator is not supported.

However, if you provide a user-defined plus operator overload (foo::operator+) that accepts a constant reference to a foo object, the code will compile. It's up to you, the class designer, to provide the appropriate implementation.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Define objects and show how they act as user defined data type in c plus plus with the help of a programme?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

In java difference between classes and object in tabluar form?

A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.


Difference between built in data type and user-defined datatype?

A built in data type is a framework's native data type. By default you'd probably have some built in generic data types, such as integer, string, boolean and so on. In the other hand sometimes you can extend the framework's data types, by programminga user-defined data type. In this data type you have to define it's behaviour and structure, and once defined, you can use it the same way you use the default data types. In PostgreSQL or Oracle, you can define data types. You can read about it on their webs.


What are the Difference between primitive data types and wrapper classes?

A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.


Why is python an object oriented programming language?

I suspect you mean, "What makes Python an OO language?" Well, first of all, you can define objects. But, way beyond that, all of the data types are objects, as well as methods and functions.


Is address a user-defined data type?

You can define a data-type called 'address': 1. typedef void *address; 2. typedef struct address { char country [32]; char state [32]; ... } address.

Related questions

What are user defined data types?

Actually user defined data type made by user like array,structure,union,pointer. the data type which is define by user or programer according to his need is called user define data type and also called the programer define data type........


In java difference between classes and object in tabluar form?

A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.A class is a template to create objects. You define the general behavior of a new data type in a class; then you create objects as specific variables of the new type. In other words, you can consider the class as a data type.


Difference between built in data type and user-defined datatype?

A built in data type is a framework's native data type. By default you'd probably have some built in generic data types, such as integer, string, boolean and so on. In the other hand sometimes you can extend the framework's data types, by programminga user-defined data type. In this data type you have to define it's behaviour and structure, and once defined, you can use it the same way you use the default data types. In PostgreSQL or Oracle, you can define data types. You can read about it on their webs.


What is the need for structure datatype?

A structure is not a data type. We use structures to define new data types (user-defined data types). If we didn't have the ability to create user-defined types we'd be limited solely to the built-in data types and arrays of those types.


How is the term 'datum' defined?

Datum is the singular form of the word data in computer terminology. It also is defined as a set of values to define a specific geodetic system. The plural of this word, however, is datums.


What are the Difference between primitive data types and wrapper classes?

A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.A primitive type is, in a way, built-in, in the language. This often includes different kinds of numbers, strings, and in some languages, dates and boolean. The other data type, other than primitive, is a compound, or user-defined, data type. For example, some languages allow the programmer to define compound data types, called a "struct" in C, or a "record" in Pascal, where the programmer can define (for example) a data of type point, consisting of x, y, and z coordinates. In object-oriented languages, these user-defined types are often defined as classes.


How would you define information processing?

Information processing is defined as the collection of data into an organized and readable format. It is the process of changing raw data into information that can be used to make decisions and solve problems.


Define data base management system?

Hi, DBMS is a collection of programs where you can modify, store and extract your information. A database is an integrated collection of data,files,programs and any other objects.


What is rapid application development (RAD) data modeling?

The information flow that defines part of the business modeling phase which is redefined into a set of data objects which are required for supporting the business. The characteristics related to each object are identified and the relation between the objects is defined.


Define and describe a hacker?

A hacker is defined as someone who gains illegal access to someone's data. The stereotyped hacker is smart with computers, and could be considered a nerd.


Define external record?

External record is simply defined as case of data that is collected from outside. This is commonly used as a representation of proof in form of external files.


What is judgmental data?

define judgmental data