Last Flashcards

1
Q

codingan Polymorphism?

A
#include 
using namespace std;
class CPolygon
{
	protected:
		int width, height;
	public:
		void setup (int first, int second)
		{
			width= first;
			height= second;
		}
};
class CRectangle: public CPolygon
{
	public:
		int area()
		{
			return (width * height);
		}
};
class CTriangle: public CPolygon
{
	public:
		int area()
		{
			return (width * height / 2);
		}
}; 

int main ()
{
CRectangle rectangle;
CTriangle triangle;

CPolygon * ptr_polygon1 = &rectangle;
CPolygon * ptr_polygon2 = ▵

ptr_polygon1->setup(2,2);
ptr_polygon2->setup(2,2);

cout << rectangle.area () << endl;
cout << triangle.area () << endl;

return 0; }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Sebutkan 3 bahasa imperative?

A

C, C++, C#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Sebutkan 3 bahasa functional?

A

Haskell, Mercury, Clean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Sebutkan 3 bahasa logic?

A

Prolog, Visual Prolog, Janus

How well did you know this?
1
Not at all
2
3
4
5
Perfectly