Types in Object Oriented Programming

I am confused by why classes are considered data types.

I understand that some of them are “data”, and the other part is methods. Why are they called data types?

Procedures in procedure programming languages, such as C, sometimes contain one or more fundamental data types. But they are not called data types.

+5
source share
5 answers

Given the definition on Wikipedia:

[...] ( ) - , , , , ; , ; .

, , , C, .

() , . , .

C , , , , .

, , ( ) , .

+7

- - , (ADT). :

(ADT)?

ADT , . , ADT.

,

(ADT) , ; , . , , , (, , ) .

, , ( , private ), ( -).

+1

"" . , . , , - . , , "" .

, , . , , ( , , ). :

class Foo
{
    ...
};
void main()
{
     Foo bar;
     Foo *baz = new Foo;
     delete baz;
}
void useFoo(Foo &blah)
{
     blah.doSomething();
     ...
}

, , , . , , ( , "+" .)

+1

, . , , , , .

. , "" - , , ( ), :

typedef void (*function_type)(void *);

:

void(*pf)(void *);

, typedef, function_type. : , ...

, , - " ", .

, , , , , .

+1
source

Confusion, disintegration, combining data and procedures and defining non-essentials - this is what the OOP approach is.

Google "what's wrong with object oriented programming" for some direct answers.

-2
source

All Articles